Skip to content

Commit 8372cc7

Browse files
mithrokmurray
authored andcommitted
libeasygl: Expand color set to full set of named CSS colors.
1 parent 8978590 commit 8372cc7

File tree

3 files changed

+304
-42
lines changed

3 files changed

+304
-42
lines changed

libs/libeasygl/src/easygl_constants.h

Lines changed: 152 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,161 @@
1010
* Note that general custom colour constants should probably just be const t_color variables.
1111
*/
1212
enum color_types {
13-
WHITE = 0, BLACK, DARKGREY, LIGHTGREY,
14-
RED, ORANGE, YELLOW, GREEN, CYAN, BLUE, PURPLE, // standard ranbow colours.
15-
PINK, LIGHTPINK, DARKGREEN, MAGENTA, // some other colours
13+
// Basic colors
14+
WHITE = 0,
15+
BLACK,
16+
17+
// Remaining HTML colors
18+
ALICEBLUE,
19+
ANTIQUEWHITE,
20+
AQUA,
21+
AQUAMARINE,
22+
AZURE,
23+
BEIGE,
1624
BISQUE, // A weird colour, not unlike the "peach" colour of pencil crayons, but closer to "Blanched Almond" and "Moccasin"
25+
BLANCHEDALMOND,
26+
BLUE,
27+
BLUEVIOLET,
28+
BROWN,
29+
BURLYWOOD,
30+
CADETBLUE,
31+
CHARTREUSE,
32+
CHOCOLATE,
33+
CORAL, // A burnt pinkish-orange perhaps?
34+
CORNFLOWERBLUE,
35+
CORNSILK,
36+
CRIMSON,
37+
CYAN,
38+
DARKBLUE,
39+
DARKCYAN,
40+
DARKGOLDENROD,
41+
DARKGRAY,
42+
DARKGREEN,
43+
DARKGREY,
44+
DARKKHAKI,
45+
DARKMAGENTA,
46+
DARKOLIVEGREEN,
47+
DARKORANGE,
48+
DARKORCHID,
49+
DARKRED,
50+
DARKSALMON,
51+
DARKSEAGREEN,
52+
DARKSLATEBLUE,
53+
DARKSLATEGRAY,
54+
DARKSLATEGREY,
55+
DARKTURQUOISE,
56+
DARKVIOLET,
57+
DEEPPINK,
58+
DEEPSKYBLUE,
59+
DIMGRAY,
60+
DIMGREY,
61+
DODGERBLUE,
62+
FIREBRICK,
63+
FLORALWHITE,
64+
FORESTGREEN,
65+
FUCHSIA,
66+
GAINSBORO,
67+
GHOSTWHITE,
68+
GOLD,
69+
GOLDENROD,
70+
GRAY,
71+
GREEN,
72+
GREENYELLOW,
73+
GREY,
74+
GREY55,
75+
GREY75,
76+
HONEYDEW,
77+
HOTPINK,
78+
INDIANRED,
79+
INDIGO,
80+
IVORY,
81+
KHAKI, // Wikipedia says "a light shade of yellow-green" , but this one is more yellow, and very light
82+
LAVENDER,
83+
LAVENDERBLUSH,
84+
LAWNGREEN,
85+
LEMONCHIFFON,
86+
LIGHTBLUE,
87+
LIGHTCORAL,
88+
LIGHTCYAN,
89+
LIGHTGOLDENRODYELLOW,
90+
LIGHTGRAY,
91+
LIGHTGREEN,
92+
LIGHTGREY,
93+
LIGHTMEDIUMBLUE,
94+
LIGHTPINK,
95+
LIGHTSALMON,
96+
LIGHTSEAGREEN,
1797
LIGHTSKYBLUE, // A nice light blue
98+
LIGHTSLATEGRAY,
99+
LIGHTSLATEGREY,
100+
LIGHTSTEELBLUE,
101+
LIGHTYELLOW,
102+
LIME,
103+
LIMEGREEN,
104+
LINEN,
105+
MAGENTA,
106+
MAROON,
107+
MEDIUMAQUAMARINE,
108+
MEDIUMBLUE,
109+
MEDIUMORCHID,
110+
MEDIUMPURPLE,
111+
MEDIUMSEAGREEN,
112+
MEDIUMSLATEBLUE,
113+
MEDIUMSPRINGGREEN,
114+
MEDIUMTURQUOISE,
115+
MEDIUMVIOLETRED,
116+
MIDNIGHTBLUE,
117+
MINTCREAM,
118+
MISTYROSE,
119+
MOCCASIN,
120+
NAVAJOWHITE,
121+
NAVY,
122+
OLDLACE,
123+
OLIVE,
124+
OLIVEDRAB,
125+
ORANGE,
126+
ORANGERED,
127+
ORCHID,
128+
PALEGOLDENROD,
129+
PALEGREEN,
130+
PALETURQUOISE,
131+
PALEVIOLETRED,
132+
PAPAYAWHIP,
133+
PEACHPUFF,
134+
PERU,
135+
PINK,
136+
PLUM, // Much closer to pink than the colour of actual plums, and closer to its flower's colour
137+
POWDERBLUE,
138+
PURPLE,
139+
REBECCAPURPLE,
140+
RED,
141+
ROSYBROWN,
142+
ROYALBLUE,
143+
SADDLEBROWN,
144+
SALMON,
145+
SANDYBROWN,
146+
SEAGREEN,
147+
SEASHELL,
148+
SIENNA,
149+
SILVER,
150+
SKYBLUE,
151+
SLATEBLUE,
152+
SLATEGRAY,
153+
SLATEGREY,
154+
SNOW,
155+
SPRINGGREEN,
156+
STEELBLUE,
157+
TAN,
158+
TEAL,
18159
THISTLE, // A sort of desaturated purple, the colour of thistle flowers
19-
PLUM, // much closer to pink than the colour of actual plums, and closer to its flower's colour
20-
KHAKI, // Wikipedia says "a light shade of yellow-green" , but this one is more yellow, and very light
21-
CORAL, // A burnt pinkish-orange perhaps?
22-
TURQUOISE, // turquoise
23-
MEDIUMPURPLE, // A nice medium purple
24-
DARKSLATEBLUE, // A deep blue, almost purple
25-
DARKKHAKI, // darker khaki
26-
LIGHTMEDIUMBLUE, // A light blue, with nice contrast to white, but distinct from "BLUE" (NON-X11)
27-
SADDLEBROWN, // The browest brown in X11
28-
FIREBRICK, // dark red
29-
LIMEGREEN, // a pleasing slightly dark green
160+
TOMATO,
161+
TURQUOISE,
162+
VIOLET,
163+
WHEAT,
164+
WHITESMOKE,
165+
YELLOW,
166+
YELLOWGREEN,
167+
30168
NUM_COLOR
31169
};
32170

libs/libeasygl/src/graphics_types.cpp

Lines changed: 151 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,160 @@
55
using namespace std;
66

77
// Predefined colours
8-
const std::array<t_color,29> t_color::predef_colors = {
9-
t_color(0xFF, 0xFF, 0xFF), // "white"
10-
t_color(0x00, 0x00, 0x00), // "black"
8+
const std::array<t_color,NUM_COLOR> t_color::predef_colors = {
9+
t_color(0xFF, 0xFF, 0xFF), // "White"
10+
t_color(0x00, 0x00, 0x00), // "Black"
11+
12+
// Remaining HTML colors
13+
t_color(0xF0, 0xF8, 0xFF), // "AliceBlue"
14+
t_color(0xFA, 0xEB, 0xD7), // "AntiqueWhite"
15+
t_color(0x00, 0xFF, 0xFF), // "Aqua"
16+
t_color(0x7F, 0xFF, 0xD4), // "Aquamarine"
17+
t_color(0xF0, 0xFF, 0xFF), // "Azure"
18+
t_color(0xF5, 0xF5, 0xDC), // "Beige"
19+
t_color(0xFF, 0xE4, 0xC4), // "Bisque"
20+
t_color(0xFF, 0xEB, 0xCD), // "BlanchedAlmond"
21+
t_color(0x00, 0x00, 0xFF), // "Blue"
22+
t_color(0x8A, 0x2B, 0xE2), // "BlueViolet"
23+
t_color(0xA5, 0x2A, 0x2A), // "Brown"
24+
t_color(0xDE, 0xB8, 0x87), // "BurlyWood"
25+
t_color(0x5F, 0x9E, 0xA0), // "CadetBlue"
26+
t_color(0x7F, 0xFF, 0x00), // "Chartreuse"
27+
t_color(0xD2, 0x69, 0x1E), // "Chocolate"
28+
t_color(0xFF, 0x7F, 0x50), // "Coral"
29+
t_color(0x64, 0x95, 0xED), // "CornflowerBlue"
30+
t_color(0xFF, 0xF8, 0xDC), // "Cornsilk"
31+
t_color(0xDC, 0x14, 0x3C), // "Crimson"
32+
t_color(0x00, 0xFF, 0xFF), // "Cyan"
33+
t_color(0x00, 0x00, 0x8B), // "DarkBlue"
34+
t_color(0x00, 0x8B, 0x8B), // "DarkCyan"
35+
t_color(0xB8, 0x86, 0x0B), // "DarkGoldenRod"
36+
t_color(0xA9, 0xA9, 0xA9), // "DarkGray"
37+
t_color(0x00, 0x64, 0x00), // "DarkGreen"
38+
t_color(0xA9, 0xA9, 0xA9), // "DarkGrey"
39+
t_color(0xBD, 0xB7, 0x6B), // "DarkKhaki"
40+
t_color(0x8B, 0x00, 0x8B), // "DarkMagenta"
41+
t_color(0x55, 0x6B, 0x2F), // "DarkOliveGreen"
42+
t_color(0xFF, 0x8C, 0x00), // "DarkOrange"
43+
t_color(0x99, 0x32, 0xCC), // "DarkOrchid"
44+
t_color(0x8B, 0x00, 0x00), // "DarkRed"
45+
t_color(0xE9, 0x96, 0x7A), // "DarkSalmon"
46+
t_color(0x8F, 0xBC, 0x8F), // "DarkSeaGreen"
47+
t_color(0x48, 0x3D, 0x8B), // "DarkSlateBlue"
48+
t_color(0x2F, 0x4F, 0x4F), // "DarkSlateGray"
49+
t_color(0x2F, 0x4F, 0x4F), // "DarkSlateGrey"
50+
t_color(0x00, 0xCE, 0xD1), // "DarkTurquoise"
51+
t_color(0x94, 0x00, 0xD3), // "DarkViolet"
52+
t_color(0xFF, 0x14, 0x93), // "DeepPink"
53+
t_color(0x00, 0xBF, 0xFF), // "DeepSkyBlue"
54+
t_color(0x69, 0x69, 0x69), // "DimGray"
55+
t_color(0x69, 0x69, 0x69), // "DimGrey"
56+
t_color(0x1E, 0x90, 0xFF), // "DodgerBlue"
57+
t_color(0xB2, 0x22, 0x22), // "FireBrick"
58+
t_color(0xFF, 0xFA, 0xF0), // "FloralWhite"
59+
t_color(0x22, 0x8B, 0x22), // "ForestGreen"
60+
t_color(0xFF, 0x00, 0xFF), // "Fuchsia"
61+
t_color(0xDC, 0xDC, 0xDC), // "Gainsboro"
62+
t_color(0xF8, 0xF8, 0xFF), // "GhostWhite"
63+
t_color(0xFF, 0xD7, 0x00), // "Gold"
64+
t_color(0xDA, 0xA5, 0x20), // "GoldenRod"
65+
t_color(0x80, 0x80, 0x80), // "Gray"
66+
t_color(0x00, 0x80, 0x00), // "Green"
67+
t_color(0xAD, 0xFF, 0x2F), // "GreenYellow"
68+
t_color(0x80, 0x80, 0x80), // "Grey"
1169
t_color(0x8C, 0x8C, 0x8C), // "grey55"
1270
t_color(0xBF, 0xBF, 0xBF), // "grey75"
13-
t_color(0xFF, 0x00, 0x00), // "red"
14-
t_color(0xFF, 0xA5, 0x00), // "orange"
15-
t_color(0xFF, 0xFF, 0x00), // "yellow"
16-
t_color(0x00, 0xFF, 0x00), // "green"
17-
t_color(0x00, 0xFF, 0xFF), // "cyan"
18-
t_color(0x00, 0x00, 0xFF), // "blue"
19-
t_color(0xA0, 0x20, 0xF0), // "purple"
20-
t_color(0xFF, 0xC0, 0xCB), // "pink"
21-
t_color(0xFF, 0xB6, 0xC1), // "lightpink"
22-
t_color(0x00, 0x64, 0x00), // "darkgreen"
23-
t_color(0xFF, 0x00, 0xFF), // "magenta"
24-
t_color(0xFF, 0xE4, 0xC4), // "bisque"
25-
t_color(0x87, 0xCE, 0xFA), // "lightskyblue"
26-
t_color(0xD8, 0xBF, 0xD8), // "thistle"
27-
t_color(0xDD, 0xA0, 0xDD), // "plum"
28-
t_color(0xF0, 0xE6, 0x8C), // "khaki"
29-
t_color(0xFF, 0x7F, 0x50), // "coral"
30-
t_color(0x40, 0xE0, 0xD0), // "turquoise"
31-
t_color(0x93, 0x70, 0xDB), // "mediumpurple"
32-
t_color(0x48, 0x3D, 0x8B), // "darkslateblue"
33-
t_color(0xBD, 0xB7, 0x6B), // "darkkhaki"
71+
t_color(0xF0, 0xFF, 0xF0), // "HoneyDew"
72+
t_color(0xFF, 0x69, 0xB4), // "HotPink"
73+
t_color(0xCD, 0x5C, 0x5C), // "IndianRed"
74+
t_color(0x4B, 0x00, 0x82), // "Indigo"
75+
t_color(0xFF, 0xFF, 0xF0), // "Ivory"
76+
t_color(0xF0, 0xE6, 0x8C), // "Khaki"
77+
t_color(0xE6, 0xE6, 0xFA), // "Lavender"
78+
t_color(0xFF, 0xF0, 0xF5), // "LavenderBlush"
79+
t_color(0x7C, 0xFC, 0x00), // "LawnGreen"
80+
t_color(0xFF, 0xFA, 0xCD), // "LemonChiffon"
81+
t_color(0xAD, 0xD8, 0xE6), // "LightBlue"
82+
t_color(0xF0, 0x80, 0x80), // "LightCoral"
83+
t_color(0xE0, 0xFF, 0xFF), // "LightCyan"
84+
t_color(0xFA, 0xFA, 0xD2), // "LightGoldenRodYellow"
85+
t_color(0xD3, 0xD3, 0xD3), // "LightGray"
86+
t_color(0x90, 0xEE, 0x90), // "LightGreen"
87+
t_color(0xD3, 0xD3, 0xD3), // "LightGrey"
3488
t_color(0x44, 0x44, 0xFF), // "lightmediumblue"
35-
t_color(0x8B, 0x45, 0x13), // "saddlebrown"
36-
t_color(0xB2, 0x22, 0x22), // "firebrick"
37-
t_color(0x32, 0xCD, 0x32) // "limegreen"
89+
t_color(0xFF, 0xB6, 0xC1), // "LightPink"
90+
t_color(0xFF, 0xA0, 0x7A), // "LightSalmon"
91+
t_color(0x20, 0xB2, 0xAA), // "LightSeaGreen"
92+
t_color(0x87, 0xCE, 0xFA), // "LightSkyBlue"
93+
t_color(0x77, 0x88, 0x99), // "LightSlateGray"
94+
t_color(0x77, 0x88, 0x99), // "LightSlateGrey"
95+
t_color(0xB0, 0xC4, 0xDE), // "LightSteelBlue"
96+
t_color(0xFF, 0xFF, 0xE0), // "LightYellow"
97+
t_color(0x00, 0xFF, 0x00), // "Lime"
98+
t_color(0x32, 0xCD, 0x32), // "LimeGreen"
99+
t_color(0xFA, 0xF0, 0xE6), // "Linen"
100+
t_color(0xFF, 0x00, 0xFF), // "Magenta"
101+
t_color(0x80, 0x00, 0x00), // "Maroon"
102+
t_color(0x66, 0xCD, 0xAA), // "MediumAquaMarine"
103+
t_color(0x00, 0x00, 0xCD), // "MediumBlue"
104+
t_color(0xBA, 0x55, 0xD3), // "MediumOrchid"
105+
t_color(0x93, 0x70, 0xDB), // "MediumPurple"
106+
t_color(0x3C, 0xB3, 0x71), // "MediumSeaGreen"
107+
t_color(0x7B, 0x68, 0xEE), // "MediumSlateBlue"
108+
t_color(0x00, 0xFA, 0x9A), // "MediumSpringGreen"
109+
t_color(0x48, 0xD1, 0xCC), // "MediumTurquoise"
110+
t_color(0xC7, 0x15, 0x85), // "MediumVioletRed"
111+
t_color(0x19, 0x19, 0x70), // "MidnightBlue"
112+
t_color(0xF5, 0xFF, 0xFA), // "MintCream"
113+
t_color(0xFF, 0xE4, 0xE1), // "MistyRose"
114+
t_color(0xFF, 0xE4, 0xB5), // "Moccasin"
115+
t_color(0xFF, 0xDE, 0xAD), // "NavajoWhite"
116+
t_color(0x00, 0x00, 0x80), // "Navy"
117+
t_color(0xFD, 0xF5, 0xE6), // "OldLace"
118+
t_color(0x80, 0x80, 0x00), // "Olive"
119+
t_color(0x6B, 0x8E, 0x23), // "OliveDrab"
120+
t_color(0xFF, 0xA5, 0x00), // "Orange"
121+
t_color(0xFF, 0x45, 0x00), // "OrangeRed"
122+
t_color(0xDA, 0x70, 0xD6), // "Orchid"
123+
t_color(0xEE, 0xE8, 0xAA), // "PaleGoldenRod"
124+
t_color(0x98, 0xFB, 0x98), // "PaleGreen"
125+
t_color(0xAF, 0xEE, 0xEE), // "PaleTurquoise"
126+
t_color(0xDB, 0x70, 0x93), // "PaleVioletRed"
127+
t_color(0xFF, 0xEF, 0xD5), // "PapayaWhip"
128+
t_color(0xFF, 0xDA, 0xB9), // "PeachPuff"
129+
t_color(0xCD, 0x85, 0x3F), // "Peru"
130+
t_color(0xFF, 0xC0, 0xCB), // "Pink"
131+
t_color(0xDD, 0xA0, 0xDD), // "Plum"
132+
t_color(0xB0, 0xE0, 0xE6), // "PowderBlue"
133+
t_color(0x80, 0x00, 0x80), // "Purple"
134+
t_color(0x66, 0x33, 0x99), // "RebeccaPurple"
135+
t_color(0xFF, 0x00, 0x00), // "Red"
136+
t_color(0xBC, 0x8F, 0x8F), // "RosyBrown"
137+
t_color(0x41, 0x69, 0xE1), // "RoyalBlue"
138+
t_color(0x8B, 0x45, 0x13), // "SaddleBrown"
139+
t_color(0xFA, 0x80, 0x72), // "Salmon"
140+
t_color(0xF4, 0xA4, 0x60), // "SandyBrown"
141+
t_color(0x2E, 0x8B, 0x57), // "SeaGreen"
142+
t_color(0xFF, 0xF5, 0xEE), // "SeaShell"
143+
t_color(0xA0, 0x52, 0x2D), // "Sienna"
144+
t_color(0xC0, 0xC0, 0xC0), // "Silver"
145+
t_color(0x87, 0xCE, 0xEB), // "SkyBlue"
146+
t_color(0x6A, 0x5A, 0xCD), // "SlateBlue"
147+
t_color(0x70, 0x80, 0x90), // "SlateGray"
148+
t_color(0x70, 0x80, 0x90), // "SlateGrey"
149+
t_color(0xFF, 0xFA, 0xFA), // "Snow"
150+
t_color(0x00, 0xFF, 0x7F), // "SpringGreen"
151+
t_color(0x46, 0x82, 0xB4), // "SteelBlue"
152+
t_color(0xD2, 0xB4, 0x8C), // "Tan"
153+
t_color(0x00, 0x80, 0x80), // "Teal"
154+
t_color(0xD8, 0xBF, 0xD8), // "Thistle"
155+
t_color(0xFF, 0x63, 0x47), // "Tomato"
156+
t_color(0x40, 0xE0, 0xD0), // "Turquoise"
157+
t_color(0xEE, 0x82, 0xEE), // "Violet"
158+
t_color(0xF5, 0xDE, 0xB3), // "Wheat"
159+
t_color(0xF5, 0xF5, 0xF5), // "WhiteSmoke"
160+
t_color(0xFF, 0xFF, 0x00), // "Yellow"
161+
t_color(0x9A, 0xCD, 0x32), // "YellowGreen"
38162
};
39163

40164

libs/libeasygl/src/graphics_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class t_color {
163163
bool operator==(color_types rhs) const;
164164
bool operator!=(color_types rhs) const;
165165

166-
static const std::array<t_color,29> predef_colors;
166+
static const std::array<t_color,NUM_COLOR> predef_colors;
167167
};
168168

169169
#endif /* GRAPHICS_TYPES_H */

0 commit comments

Comments
 (0)