GRASS GIS 8 Programmer's Manual  8.5.0dev(2025)-f22b1278f8
defs/colors.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int G_num_standard_colors (void)
 Get number of named colors (RGB triplets) More...
 
struct color_rgb G_standard_color_rgb (int)
 Get RGB triplet of given color. More...
 
int G_num_standard_color_names (void)
 Get number of named colors (color names) More...
 
const struct color_nameG_standard_color_name (int)
 Get color name. More...
 
int G_str_to_color (const char *, int *, int *, int *)
 Parse color string and set red,green,blue. More...
 
void G_rgb_to_hsv (int, int, int, float *, float *, float *)
 Converts RGB color values to HSV format. More...
 

Function Documentation

◆ G_num_standard_color_names()

int G_num_standard_color_names ( void  )

Get number of named colors (color names)

Returns
number of colors

Definition at line 75 of file color_str.c.

Referenced by G_str_to_color().

◆ G_num_standard_colors()

int G_num_standard_colors ( void  )

Get number of named colors (RGB triplets)

Returns
number of colors

Definition at line 55 of file color_str.c.

Referenced by COM_Standard_color(), and D_use_color().

◆ G_rgb_to_hsv()

void G_rgb_to_hsv ( int  r,
int  g,
int  b,
float *  h,
float *  s,
float *  v 
)

Converts RGB color values to HSV format.

Note
This implementation is experimental and may be subject to change.
Parameters
rred component of the RGB color
ggreen component of the RGB color
bblue component of the RGB color
[out]hpointer to store the calculated hue
[out]spointer to store the calculated saturation
[out]vpointer to store the calculated value

Definition at line 167 of file color_str.c.

◆ G_standard_color_name()

const struct color_name* G_standard_color_name ( int  n)

Get color name.

Parameters
ncolor index

Definition at line 85 of file color_str.c.

◆ G_standard_color_rgb()

struct color_rgb G_standard_color_rgb ( int  n)

Get RGB triplet of given color.

Parameters
ncolor index

Definition at line 55 of file color_str.c.

Referenced by COM_Standard_color().

◆ G_str_to_color()

int G_str_to_color ( const char *  str,
int *  red,
int *  grn,
int *  blu 
)

Parse color string and set red,green,blue.

Parameters
strcolor string
[out]redred value
[out]grngreen value
[out]blublue value
Returns
1 OK
2 NONE
0 on error

Definition at line 102 of file color_str.c.

References G_chop(), G_debug(), G_num_standard_color_names(), G_strcasecmp(), name, and strcpy.

Referenced by Cairo_Graph_set(), I_iclass_add_signature(), Nviz_color_from_str(), and PNG_Graph_set().