34 static int translate_or_add_color(
const char *str)
43 if (
G_strlcpy(lowerstr, str,
sizeof(lowerstr)) >=
sizeof(lowerstr)) {
49 for (i = 0; i < num_names; i++) {
60 for (i = 0; i < ncolors; i++)
73 for (i = 1; i < ncolors; i++)
74 if (colors[i].
r == red && colors[i].
g == grn && colors[i].
b == blu)
77 if (ncolors >= nalloc) {
84 colors[index].
r = red;
85 colors[index].
g = grn;
86 colors[index].
b = blu;
109 color = translate_or_add_color(str);
112 if (color == 0 && !none_acceptable)
155 if (color < ncolors) {
156 const struct color_rgb *c = &colors[color];
201 if (color >= ncolors)
int G_num_standard_colors(void)
Get number of named colors (RGB triplets)
int G_str_to_color(const char *, int *, int *, int *)
Parse color string and set red,green,blue.
int G_num_standard_color_names(void)
Get number of named colors (color names)
struct color_rgb G_standard_color_rgb(int)
Get RGB triplet of given color.
const struct color_name * G_standard_color_name(int)
Get color name.
char * G_tolcase(char *)
convert string to lower case
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_chop(char *)
Chop leading and trailing white spaces.
size_t G_strlcpy(char *, const char *, size_t)
Safe string copy function.
void COM_Standard_color(int number)
void COM_Color_RGB(unsigned char r, unsigned char g, unsigned char b)
int D_use_color(int color)
draw with a color from D_parse_color
void D_RGB_color(int red, int grn, int blu)
int D_color_number_to_RGB(int color, int *r, int *g, int *b)
get RGB values from color number
int D_parse_color(const char *str, int none_acceptable)
color option text to usable color number
int D_translate_color(const char *str)
color name to number