GRASS GIS 8 Programmer's Manual  8.5.0dev(2025)-cf2ad99485
colors.h
Go to the documentation of this file.
1 #ifndef GRASS_COLORS_H
2 #define GRASS_COLORS_H
3 
4 /* Don't add more colors here.
5  These colors are the preallocated colors used in displays for efficiency.
6  Adding colors here reduces the number of colors it is possible for a user to
7  display. If support for named colors is needed it should go in
8  G_str_to_color. */
9 
10 #define BLACK 1
11 #define RED 2
12 #define GREEN 3
13 #define BLUE 4
14 #define YELLOW 5
15 #define CYAN 6
16 #define MAGENTA 7
17 #define WHITE 8
18 #define GRAY 9
19 #define ORANGE 10
20 #define AQUA 11
21 #define INDIGO 12
22 #define VIOLET 13
23 #define BROWN 14
24 
25 #define GREY GRAY
26 #define PURPLE VIOLET
27 
28 #define COLOR_STRING_LENGTH 30
29 
30 /* These can be in any order. They must match the lookup strings in the table
31  * below. */
32 #define D_COLOR_LIST \
33  "red,orange,yellow,green,blue,indigo,violet,white,black,gray,brown," \
34  "magenta,aqua,grey,cyan,purple"
35 
36 /* max length of color string */
37 #define MAX_COLOR_LEN 32
38 
39 struct color_rgb {
40  unsigned char r, g, b;
41 };
42 
43 struct color_name {
44  const char *name;
45  int number;
46 };
47 
48 /*!
49  \typedef ColorFormat
50  \brief Color format identifiers (enum)
51 
52  Identifiers of all recognized color formats.
53 
54  */
55 typedef enum { RGB, HEX, HSV, TRIPLET } ColorFormat;
56 
57 #include <grass/defs/colors.h>
58 
59 #endif
ColorFormat
Color format identifiers (enum)
Definition: colors.h:55
@ HSV
Definition: colors.h:55
@ RGB
Definition: colors.h:55
@ TRIPLET
Definition: colors.h:55
@ HEX
Definition: colors.h:55
const char * name
Definition: colors.h:44
int number
Definition: colors.h:45
unsigned char g
Definition: colors.h:40
unsigned char b
Definition: colors.h:40
unsigned char r
Definition: colors.h:40