[GRASS5] Hex equivalents of grass colors?
Glynn Clements
glynn at gclements.plus.com
Sun Apr 16 01:14:58 EDT 2006
Cedric Shock wrote:
> Michael,
>
> > Is there some kind of lookup available for the hex equivalent of standard
> > grass colors (red, violet, etc)? Lacking that, is there an RGB lookup that
> > I could translate to hex?
>
> This is information is on my wish list too. I found it in:
> http://freegis.org/cgi-bin/viewcvs.cgi/grass6/lib/gis/color_str.c
>
> {"white", 255, 255, 255},
> {"black", 0, 0, 0},
> {"red", 255, 0, 0},
> {"green", 0, 255, 0},
> {"blue", 0, 0, 255},
> {"yellow", 255, 255, 0},
> {"magenta", 255, 0, 255},
> {"cyan", 0, 255, 255},
> {"aqua", 100, 127, 255},
> {"grey", 127, 127, 127},
> {"gray", 127, 127, 127},
> {"orange", 255, 127, 0},
> {"brown", 180, 75, 25},
> {"violet", 255, 0, 255},
> {"indigo", 0, 127, 255}
However, this doesn't exactly match the colours used by the display
drivers. Both the PNG and X drivers use:
LIB_assign_standard_color(RED, DRV_lookup_color(255, 0, 0));
LIB_assign_standard_color(ORANGE, DRV_lookup_color(255, 128, 0));
LIB_assign_standard_color(YELLOW, DRV_lookup_color(255, 255, 0));
LIB_assign_standard_color(GREEN, DRV_lookup_color( 0, 255, 0));
LIB_assign_standard_color(BLUE, DRV_lookup_color( 0, 0, 255));
LIB_assign_standard_color(INDIGO, DRV_lookup_color( 0, 128, 255));
LIB_assign_standard_color(VIOLET, DRV_lookup_color(255, 0, 255));
LIB_assign_standard_color(BLACK, DRV_lookup_color( 0, 0, 0));
LIB_assign_standard_color(WHITE, DRV_lookup_color(255, 255, 255));
LIB_assign_standard_color(GRAY, DRV_lookup_color(175, 175, 175));
LIB_assign_standard_color(BROWN, DRV_lookup_color(180, 77, 25));
LIB_assign_standard_color(MAGENTA, DRV_lookup_color(255, 0, 128));
LIB_assign_standard_color(AQUA, DRV_lookup_color(100, 128, 255));
The main differences are for magenta and grey. The driver's magenta is
definitely wrong, as magenta is supposed to be one of the corners of
the RGB cube; maybe those values should be used for violet?
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list