[rrd-users] Re: rrdtool- question on line colors

Tobias Oetiker oetiker at ee.ethz.ch
Mon Apr 29 16:02:09 MEST 2002


Today 'Donald Mahler' wrote:

>
I quite like walking the hsv weal ... here is some code ...

/* code stolen from the gimp */
unsigned int
hsv2rgb(double h, double s, double v, art_u8 alpha)
{
  int    j;
  double rd, gd, bd;
  double f, p, q, t;
  if (s == 0.0)
    s = 0.000001;
  if (h == -1.0) {
      rd = v;
      gd = v;
      bd = v;
  } else {
    while (h >= 360.0) h = h - 360.0;
    while (h <  0.0) h = h + 360.0;
    h= h / 60.0;

    j = (int)h;
    f = h - j;
    p = v * (1.0 - s );
    q = v * (1.0 - (s*f));
    t = v * (1.0 - (s* (1.0 - f)));

    switch (j) {
    case 0:  rd = v;  gd = t;  bd = p;  break;
    case 1:  rd = q;  gd = v;  bd = p;  break;
    case 2:  rd = p;  gd = v;  bd = t;  break;
    case 3:  rd = p;  gd = q;  bd = v;  break;
    case 4:  rd = t;  gd = p;  bd = v;  break;
    case 5:  rd = v;  gd = p;  bd = q;  break;
    default: rd = v;  gd = t;  bd = p;  break;
    }
  }
  return
    ((unsigned int)(rd*255.0) << 24) +
    ((unsigned int)(gd*255.0) << 16) +
    ((unsigned int)(bd*255.0) << 8) + alpha;
}


>
>
> Does anyone have a mathematical methodology for setting the rrdtool line
> colors that they could share?
>
> I am graphing up to 10 lines on a single graph and there are times that the
> colors are just too close (at least for my... ahem... perception of color :
> -)
>
>
> I was thinking   cycling thru the colors as such...
>
> 000000
> 000033
> 000066
> 000099
> 0000cc
> 330000
> 330033
> 330066
> 3300cc
> 660000
> 660033
> 660066
> 6600cc
>
>
> is this reasonable?   how are others doing this?
>
>
>
> Don M
>
>
>
>
>
> --
> Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
> Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
> Archive     http://www.ee.ethz.ch/~slist/rrd-users
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>
>

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, ETZ J97, ETH, 8092 Zurich, Switzerland
 / // _ \/ _ \/ / phoneto:+41(0)1-632-5286  faxto:+41(0)1-632-1517
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://google.com/search?q=tobi


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list