3 #include "color_maps.hpp"
9 const char aliceblue [] = "aliceblue";
10 const char antiquewhite [] = "antiquewhite";
11 const char cyan [] = "cyan";
12 const char aqua [] = "aqua";
13 const char aquamarine [] = "aquamarine";
14 const char azure [] = "azure";
15 const char beige [] = "beige";
16 const char bisque [] = "bisque";
17 const char black [] = "black";
18 const char blanchedalmond [] = "blanchedalmond";
19 const char blue [] = "blue";
20 const char blueviolet [] = "blueviolet";
21 const char brown [] = "brown";
22 const char burlywood [] = "burlywood";
23 const char cadetblue [] = "cadetblue";
24 const char chartreuse [] = "chartreuse";
25 const char chocolate [] = "chocolate";
26 const char coral [] = "coral";
27 const char cornflowerblue [] = "cornflowerblue";
28 const char cornsilk [] = "cornsilk";
29 const char crimson [] = "crimson";
30 const char darkblue [] = "darkblue";
31 const char darkcyan [] = "darkcyan";
32 const char darkgoldenrod [] = "darkgoldenrod";
33 const char darkgray [] = "darkgray";
34 const char darkgrey [] = "darkgrey";
35 const char darkgreen [] = "darkgreen";
36 const char darkkhaki [] = "darkkhaki";
37 const char darkmagenta [] = "darkmagenta";
38 const char darkolivegreen [] = "darkolivegreen";
39 const char darkorange [] = "darkorange";
40 const char darkorchid [] = "darkorchid";
41 const char darkred [] = "darkred";
42 const char darksalmon [] = "darksalmon";
43 const char darkseagreen [] = "darkseagreen";
44 const char darkslateblue [] = "darkslateblue";
45 const char darkslategray [] = "darkslategray";
46 const char darkslategrey [] = "darkslategrey";
47 const char darkturquoise [] = "darkturquoise";
48 const char darkviolet [] = "darkviolet";
49 const char deeppink [] = "deeppink";
50 const char deepskyblue [] = "deepskyblue";
51 const char dimgray [] = "dimgray";
52 const char dimgrey [] = "dimgrey";
53 const char dodgerblue [] = "dodgerblue";
54 const char firebrick [] = "firebrick";
55 const char floralwhite [] = "floralwhite";
56 const char forestgreen [] = "forestgreen";
57 const char magenta [] = "magenta";
58 const char fuchsia [] = "fuchsia";
59 const char gainsboro [] = "gainsboro";
60 const char ghostwhite [] = "ghostwhite";
61 const char gold [] = "gold";
62 const char goldenrod [] = "goldenrod";
63 const char gray [] = "gray";
64 const char grey [] = "grey";
65 const char green [] = "green";
66 const char greenyellow [] = "greenyellow";
67 const char honeydew [] = "honeydew";
68 const char hotpink [] = "hotpink";
69 const char indianred [] = "indianred";
70 const char indigo [] = "indigo";
71 const char ivory [] = "ivory";
72 const char khaki [] = "khaki";
73 const char lavender [] = "lavender";
74 const char lavenderblush [] = "lavenderblush";
75 const char lawngreen [] = "lawngreen";
76 const char lemonchiffon [] = "lemonchiffon";
77 const char lightblue [] = "lightblue";
78 const char lightcoral [] = "lightcoral";
79 const char lightcyan [] = "lightcyan";
80 const char lightgoldenrodyellow [] = "lightgoldenrodyellow";
81 const char lightgray [] = "lightgray";
82 const char lightgrey [] = "lightgrey";
83 const char lightgreen [] = "lightgreen";
84 const char lightpink [] = "lightpink";
85 const char lightsalmon [] = "lightsalmon";
86 const char lightseagreen [] = "lightseagreen";
87 const char lightskyblue [] = "lightskyblue";
88 const char lightslategray [] = "lightslategray";
89 const char lightslategrey [] = "lightslategrey";
90 const char lightsteelblue [] = "lightsteelblue";
91 const char lightyellow [] = "lightyellow";
92 const char lime [] = "lime";
93 const char limegreen [] = "limegreen";
94 const char linen [] = "linen";
95 const char maroon [] = "maroon";
96 const char mediumaquamarine [] = "mediumaquamarine";
97 const char mediumblue [] = "mediumblue";
98 const char mediumorchid [] = "mediumorchid";
99 const char mediumpurple [] = "mediumpurple";
100 const char mediumseagreen [] = "mediumseagreen";
101 const char mediumslateblue [] = "mediumslateblue";
102 const char mediumspringgreen [] = "mediumspringgreen";
103 const char mediumturquoise [] = "mediumturquoise";
104 const char mediumvioletred [] = "mediumvioletred";
105 const char midnightblue [] = "midnightblue";
106 const char mintcream [] = "mintcream";
107 const char mistyrose [] = "mistyrose";
108 const char moccasin [] = "moccasin";
109 const char navajowhite [] = "navajowhite";
110 const char navy [] = "navy";
111 const char oldlace [] = "oldlace";
112 const char olive [] = "olive";
113 const char olivedrab [] = "olivedrab";
114 const char orange [] = "orange";
115 const char orangered [] = "orangered";
116 const char orchid [] = "orchid";
117 const char palegoldenrod [] = "palegoldenrod";
118 const char palegreen [] = "palegreen";
119 const char paleturquoise [] = "paleturquoise";
120 const char palevioletred [] = "palevioletred";
121 const char papayawhip [] = "papayawhip";
122 const char peachpuff [] = "peachpuff";
123 const char peru [] = "peru";
124 const char pink [] = "pink";
125 const char plum [] = "plum";
126 const char powderblue [] = "powderblue";
127 const char purple [] = "purple";
128 const char red [] = "red";
129 const char rosybrown [] = "rosybrown";
130 const char royalblue [] = "royalblue";
131 const char saddlebrown [] = "saddlebrown";
132 const char salmon [] = "salmon";
133 const char sandybrown [] = "sandybrown";
134 const char seagreen [] = "seagreen";
135 const char seashell [] = "seashell";
136 const char sienna [] = "sienna";
137 const char silver [] = "silver";
138 const char skyblue [] = "skyblue";
139 const char slateblue [] = "slateblue";
140 const char slategray [] = "slategray";
141 const char slategrey [] = "slategrey";
142 const char snow [] = "snow";
143 const char springgreen [] = "springgreen";
144 const char steelblue [] = "steelblue";
145 const char tan [] = "tan";
146 const char teal [] = "teal";
147 const char thistle [] = "thistle";
148 const char tomato [] = "tomato";
149 const char turquoise [] = "turquoise";
150 const char violet [] = "violet";
151 const char wheat [] = "wheat";
152 const char white [] = "white";
153 const char whitesmoke [] = "whitesmoke";
154 const char yellow [] = "yellow";
155 const char yellowgreen [] = "yellowgreen";
156 const char rebeccapurple [] = "rebeccapurple";
157 const char transparent [] = "transparent";
161 const ParserState color_table("[COLOR TABLE]");
162 const Color aliceblue(color_table, 240, 248, 255, 1);
163 const Color antiquewhite(color_table, 250, 235, 215, 1);
164 const Color cyan(color_table, 0, 255, 255, 1);
165 const Color aqua(color_table, 0, 255, 255, 1);
166 const Color aquamarine(color_table, 127, 255, 212, 1);
167 const Color azure(color_table, 240, 255, 255, 1);
168 const Color beige(color_table, 245, 245, 220, 1);
169 const Color bisque(color_table, 255, 228, 196, 1);
170 const Color black(color_table, 0, 0, 0, 1);
171 const Color blanchedalmond(color_table, 255, 235, 205, 1);
172 const Color blue(color_table, 0, 0, 255, 1);
173 const Color blueviolet(color_table, 138, 43, 226, 1);
174 const Color brown(color_table, 165, 42, 42, 1);
175 const Color burlywood(color_table, 222, 184, 135, 1);
176 const Color cadetblue(color_table, 95, 158, 160, 1);
177 const Color chartreuse(color_table, 127, 255, 0, 1);
178 const Color chocolate(color_table, 210, 105, 30, 1);
179 const Color coral(color_table, 255, 127, 80, 1);
180 const Color cornflowerblue(color_table, 100, 149, 237, 1);
181 const Color cornsilk(color_table, 255, 248, 220, 1);
182 const Color crimson(color_table, 220, 20, 60, 1);
183 const Color darkblue(color_table, 0, 0, 139, 1);
184 const Color darkcyan(color_table, 0, 139, 139, 1);
185 const Color darkgoldenrod(color_table, 184, 134, 11, 1);
186 const Color darkgray(color_table, 169, 169, 169, 1);
187 const Color darkgrey(color_table, 169, 169, 169, 1);
188 const Color darkgreen(color_table, 0, 100, 0, 1);
189 const Color darkkhaki(color_table, 189, 183, 107, 1);
190 const Color darkmagenta(color_table, 139, 0, 139, 1);
191 const Color darkolivegreen(color_table, 85, 107, 47, 1);
192 const Color darkorange(color_table, 255, 140, 0, 1);
193 const Color darkorchid(color_table, 153, 50, 204, 1);
194 const Color darkred(color_table, 139, 0, 0, 1);
195 const Color darksalmon(color_table, 233, 150, 122, 1);
196 const Color darkseagreen(color_table, 143, 188, 143, 1);
197 const Color darkslateblue(color_table, 72, 61, 139, 1);
198 const Color darkslategray(color_table, 47, 79, 79, 1);
199 const Color darkslategrey(color_table, 47, 79, 79, 1);
200 const Color darkturquoise(color_table, 0, 206, 209, 1);
201 const Color darkviolet(color_table, 148, 0, 211, 1);
202 const Color deeppink(color_table, 255, 20, 147, 1);
203 const Color deepskyblue(color_table, 0, 191, 255, 1);
204 const Color dimgray(color_table, 105, 105, 105, 1);
205 const Color dimgrey(color_table, 105, 105, 105, 1);
206 const Color dodgerblue(color_table, 30, 144, 255, 1);
207 const Color firebrick(color_table, 178, 34, 34, 1);
208 const Color floralwhite(color_table, 255, 250, 240, 1);
209 const Color forestgreen(color_table, 34, 139, 34, 1);
210 const Color magenta(color_table, 255, 0, 255, 1);
211 const Color fuchsia(color_table, 255, 0, 255, 1);
212 const Color gainsboro(color_table, 220, 220, 220, 1);
213 const Color ghostwhite(color_table, 248, 248, 255, 1);
214 const Color gold(color_table, 255, 215, 0, 1);
215 const Color goldenrod(color_table, 218, 165, 32, 1);
216 const Color gray(color_table, 128, 128, 128, 1);
217 const Color grey(color_table, 128, 128, 128, 1);
218 const Color green(color_table, 0, 128, 0, 1);
219 const Color greenyellow(color_table, 173, 255, 47, 1);
220 const Color honeydew(color_table, 240, 255, 240, 1);
221 const Color hotpink(color_table, 255, 105, 180, 1);
222 const Color indianred(color_table, 205, 92, 92, 1);
223 const Color indigo(color_table, 75, 0, 130, 1);
224 const Color ivory(color_table, 255, 255, 240, 1);
225 const Color khaki(color_table, 240, 230, 140, 1);
226 const Color lavender(color_table, 230, 230, 250, 1);
227 const Color lavenderblush(color_table, 255, 240, 245, 1);
228 const Color lawngreen(color_table, 124, 252, 0, 1);
229 const Color lemonchiffon(color_table, 255, 250, 205, 1);
230 const Color lightblue(color_table, 173, 216, 230, 1);
231 const Color lightcoral(color_table, 240, 128, 128, 1);
232 const Color lightcyan(color_table, 224, 255, 255, 1);
233 const Color lightgoldenrodyellow(color_table, 250, 250, 210, 1);
234 const Color lightgray(color_table, 211, 211, 211, 1);
235 const Color lightgrey(color_table, 211, 211, 211, 1);
236 const Color lightgreen(color_table, 144, 238, 144, 1);
237 const Color lightpink(color_table, 255, 182, 193, 1);
238 const Color lightsalmon(color_table, 255, 160, 122, 1);
239 const Color lightseagreen(color_table, 32, 178, 170, 1);
240 const Color lightskyblue(color_table, 135, 206, 250, 1);
241 const Color lightslategray(color_table, 119, 136, 153, 1);
242 const Color lightslategrey(color_table, 119, 136, 153, 1);
243 const Color lightsteelblue(color_table, 176, 196, 222, 1);
244 const Color lightyellow(color_table, 255, 255, 224, 1);
245 const Color lime(color_table, 0, 255, 0, 1);
246 const Color limegreen(color_table, 50, 205, 50, 1);
247 const Color linen(color_table, 250, 240, 230, 1);
248 const Color maroon(color_table, 128, 0, 0, 1);
249 const Color mediumaquamarine(color_table, 102, 205, 170, 1);
250 const Color mediumblue(color_table, 0, 0, 205, 1);
251 const Color mediumorchid(color_table, 186, 85, 211, 1);
252 const Color mediumpurple(color_table, 147, 112, 219, 1);
253 const Color mediumseagreen(color_table, 60, 179, 113, 1);
254 const Color mediumslateblue(color_table, 123, 104, 238, 1);
255 const Color mediumspringgreen(color_table, 0, 250, 154, 1);
256 const Color mediumturquoise(color_table, 72, 209, 204, 1);
257 const Color mediumvioletred(color_table, 199, 21, 133, 1);
258 const Color midnightblue(color_table, 25, 25, 112, 1);
259 const Color mintcream(color_table, 245, 255, 250, 1);
260 const Color mistyrose(color_table, 255, 228, 225, 1);
261 const Color moccasin(color_table, 255, 228, 181, 1);
262 const Color navajowhite(color_table, 255, 222, 173, 1);
263 const Color navy(color_table, 0, 0, 128, 1);
264 const Color oldlace(color_table, 253, 245, 230, 1);
265 const Color olive(color_table, 128, 128, 0, 1);
266 const Color olivedrab(color_table, 107, 142, 35, 1);
267 const Color orange(color_table, 255, 165, 0, 1);
268 const Color orangered(color_table, 255, 69, 0, 1);
269 const Color orchid(color_table, 218, 112, 214, 1);
270 const Color palegoldenrod(color_table, 238, 232, 170, 1);
271 const Color palegreen(color_table, 152, 251, 152, 1);
272 const Color paleturquoise(color_table, 175, 238, 238, 1);
273 const Color palevioletred(color_table, 219, 112, 147, 1);
274 const Color papayawhip(color_table, 255, 239, 213, 1);
275 const Color peachpuff(color_table, 255, 218, 185, 1);
276 const Color peru(color_table, 205, 133, 63, 1);
277 const Color pink(color_table, 255, 192, 203, 1);
278 const Color plum(color_table, 221, 160, 221, 1);
279 const Color powderblue(color_table, 176, 224, 230, 1);
280 const Color purple(color_table, 128, 0, 128, 1);
281 const Color red(color_table, 255, 0, 0, 1);
282 const Color rosybrown(color_table, 188, 143, 143, 1);
283 const Color royalblue(color_table, 65, 105, 225, 1);
284 const Color saddlebrown(color_table, 139, 69, 19, 1);
285 const Color salmon(color_table, 250, 128, 114, 1);
286 const Color sandybrown(color_table, 244, 164, 96, 1);
287 const Color seagreen(color_table, 46, 139, 87, 1);
288 const Color seashell(color_table, 255, 245, 238, 1);
289 const Color sienna(color_table, 160, 82, 45, 1);
290 const Color silver(color_table, 192, 192, 192, 1);
291 const Color skyblue(color_table, 135, 206, 235, 1);
292 const Color slateblue(color_table, 106, 90, 205, 1);
293 const Color slategray(color_table, 112, 128, 144, 1);
294 const Color slategrey(color_table, 112, 128, 144, 1);
295 const Color snow(color_table, 255, 250, 250, 1);
296 const Color springgreen(color_table, 0, 255, 127, 1);
297 const Color steelblue(color_table, 70, 130, 180, 1);
298 const Color tan(color_table, 210, 180, 140, 1);
299 const Color teal(color_table, 0, 128, 128, 1);
300 const Color thistle(color_table, 216, 191, 216, 1);
301 const Color tomato(color_table, 255, 99, 71, 1);
302 const Color turquoise(color_table, 64, 224, 208, 1);
303 const Color violet(color_table, 238, 130, 238, 1);
304 const Color wheat(color_table, 245, 222, 179, 1);
305 const Color white(color_table, 255, 255, 255, 1);
306 const Color whitesmoke(color_table, 245, 245, 245, 1);
307 const Color yellow(color_table, 255, 255, 0, 1);
308 const Color yellowgreen(color_table, 154, 205, 50, 1);
309 const Color rebeccapurple(color_table, 102, 51, 153, 1);
310 const Color transparent(color_table, 0, 0, 0, 0);
313 const std::map<const int, const char*> colors_to_names {
314 { 240 * 0x10000 + 248 * 0x100 + 255, ColorNames::aliceblue },
315 { 250 * 0x10000 + 235 * 0x100 + 215, ColorNames::antiquewhite },
316 { 0 * 0x10000 + 255 * 0x100 + 255, ColorNames::cyan },
317 { 127 * 0x10000 + 255 * 0x100 + 212, ColorNames::aquamarine },
318 { 240 * 0x10000 + 255 * 0x100 + 255, ColorNames::azure },
319 { 245 * 0x10000 + 245 * 0x100 + 220, ColorNames::beige },
320 { 255 * 0x10000 + 228 * 0x100 + 196, ColorNames::bisque },
321 { 0 * 0x10000 + 0 * 0x100 + 0, ColorNames::black },
322 { 255 * 0x10000 + 235 * 0x100 + 205, ColorNames::blanchedalmond },
323 { 0 * 0x10000 + 0 * 0x100 + 255, ColorNames::blue },
324 { 138 * 0x10000 + 43 * 0x100 + 226, ColorNames::blueviolet },
325 { 165 * 0x10000 + 42 * 0x100 + 42, ColorNames::brown },
326 { 222 * 0x10000 + 184 * 0x100 + 135, ColorNames::burlywood },
327 { 95 * 0x10000 + 158 * 0x100 + 160, ColorNames::cadetblue },
328 { 127 * 0x10000 + 255 * 0x100 + 0, ColorNames::chartreuse },
329 { 210 * 0x10000 + 105 * 0x100 + 30, ColorNames::chocolate },
330 { 255 * 0x10000 + 127 * 0x100 + 80, ColorNames::coral },
331 { 100 * 0x10000 + 149 * 0x100 + 237, ColorNames::cornflowerblue },
332 { 255 * 0x10000 + 248 * 0x100 + 220, ColorNames::cornsilk },
333 { 220 * 0x10000 + 20 * 0x100 + 60, ColorNames::crimson },
334 { 0 * 0x10000 + 0 * 0x100 + 139, ColorNames::darkblue },
335 { 0 * 0x10000 + 139 * 0x100 + 139, ColorNames::darkcyan },
336 { 184 * 0x10000 + 134 * 0x100 + 11, ColorNames::darkgoldenrod },
337 { 169 * 0x10000 + 169 * 0x100 + 169, ColorNames::darkgray },
338 { 0 * 0x10000 + 100 * 0x100 + 0, ColorNames::darkgreen },
339 { 189 * 0x10000 + 183 * 0x100 + 107, ColorNames::darkkhaki },
340 { 139 * 0x10000 + 0 * 0x100 + 139, ColorNames::darkmagenta },
341 { 85 * 0x10000 + 107 * 0x100 + 47, ColorNames::darkolivegreen },
342 { 255 * 0x10000 + 140 * 0x100 + 0, ColorNames::darkorange },
343 { 153 * 0x10000 + 50 * 0x100 + 204, ColorNames::darkorchid },
344 { 139 * 0x10000 + 0 * 0x100 + 0, ColorNames::darkred },
345 { 233 * 0x10000 + 150 * 0x100 + 122, ColorNames::darksalmon },
346 { 143 * 0x10000 + 188 * 0x100 + 143, ColorNames::darkseagreen },
347 { 72 * 0x10000 + 61 * 0x100 + 139, ColorNames::darkslateblue },
348 { 47 * 0x10000 + 79 * 0x100 + 79, ColorNames::darkslategray },
349 { 0 * 0x10000 + 206 * 0x100 + 209, ColorNames::darkturquoise },
350 { 148 * 0x10000 + 0 * 0x100 + 211, ColorNames::darkviolet },
351 { 255 * 0x10000 + 20 * 0x100 + 147, ColorNames::deeppink },
352 { 0 * 0x10000 + 191 * 0x100 + 255, ColorNames::deepskyblue },
353 { 105 * 0x10000 + 105 * 0x100 + 105, ColorNames::dimgray },
354 { 30 * 0x10000 + 144 * 0x100 + 255, ColorNames::dodgerblue },
355 { 178 * 0x10000 + 34 * 0x100 + 34, ColorNames::firebrick },
356 { 255 * 0x10000 + 250 * 0x100 + 240, ColorNames::floralwhite },
357 { 34 * 0x10000 + 139 * 0x100 + 34, ColorNames::forestgreen },
358 { 255 * 0x10000 + 0 * 0x100 + 255, ColorNames::magenta },
359 { 220 * 0x10000 + 220 * 0x100 + 220, ColorNames::gainsboro },
360 { 248 * 0x10000 + 248 * 0x100 + 255, ColorNames::ghostwhite },
361 { 255 * 0x10000 + 215 * 0x100 + 0, ColorNames::gold },
362 { 218 * 0x10000 + 165 * 0x100 + 32, ColorNames::goldenrod },
363 { 128 * 0x10000 + 128 * 0x100 + 128, ColorNames::gray },
364 { 0 * 0x10000 + 128 * 0x100 + 0, ColorNames::green },
365 { 173 * 0x10000 + 255 * 0x100 + 47, ColorNames::greenyellow },
366 { 240 * 0x10000 + 255 * 0x100 + 240, ColorNames::honeydew },
367 { 255 * 0x10000 + 105 * 0x100 + 180, ColorNames::hotpink },
368 { 205 * 0x10000 + 92 * 0x100 + 92, ColorNames::indianred },
369 { 75 * 0x10000 + 0 * 0x100 + 130, ColorNames::indigo },
370 { 255 * 0x10000 + 255 * 0x100 + 240, ColorNames::ivory },
371 { 240 * 0x10000 + 230 * 0x100 + 140, ColorNames::khaki },
372 { 230 * 0x10000 + 230 * 0x100 + 250, ColorNames::lavender },
373 { 255 * 0x10000 + 240 * 0x100 + 245, ColorNames::lavenderblush },
374 { 124 * 0x10000 + 252 * 0x100 + 0, ColorNames::lawngreen },
375 { 255 * 0x10000 + 250 * 0x100 + 205, ColorNames::lemonchiffon },
376 { 173 * 0x10000 + 216 * 0x100 + 230, ColorNames::lightblue },
377 { 240 * 0x10000 + 128 * 0x100 + 128, ColorNames::lightcoral },
378 { 224 * 0x10000 + 255 * 0x100 + 255, ColorNames::lightcyan },
379 { 250 * 0x10000 + 250 * 0x100 + 210, ColorNames::lightgoldenrodyellow },
380 { 211 * 0x10000 + 211 * 0x100 + 211, ColorNames::lightgray },
381 { 144 * 0x10000 + 238 * 0x100 + 144, ColorNames::lightgreen },
382 { 255 * 0x10000 + 182 * 0x100 + 193, ColorNames::lightpink },
383 { 255 * 0x10000 + 160 * 0x100 + 122, ColorNames::lightsalmon },
384 { 32 * 0x10000 + 178 * 0x100 + 170, ColorNames::lightseagreen },
385 { 135 * 0x10000 + 206 * 0x100 + 250, ColorNames::lightskyblue },
386 { 119 * 0x10000 + 136 * 0x100 + 153, ColorNames::lightslategray },
387 { 176 * 0x10000 + 196 * 0x100 + 222, ColorNames::lightsteelblue },
388 { 255 * 0x10000 + 255 * 0x100 + 224, ColorNames::lightyellow },
389 { 0 * 0x10000 + 255 * 0x100 + 0, ColorNames::lime },
390 { 50 * 0x10000 + 205 * 0x100 + 50, ColorNames::limegreen },
391 { 250 * 0x10000 + 240 * 0x100 + 230, ColorNames::linen },
392 { 128 * 0x10000 + 0 * 0x100 + 0, ColorNames::maroon },
393 { 102 * 0x10000 + 205 * 0x100 + 170, ColorNames::mediumaquamarine },
394 { 0 * 0x10000 + 0 * 0x100 + 205, ColorNames::mediumblue },
395 { 186 * 0x10000 + 85 * 0x100 + 211, ColorNames::mediumorchid },
396 { 147 * 0x10000 + 112 * 0x100 + 219, ColorNames::mediumpurple },
397 { 60 * 0x10000 + 179 * 0x100 + 113, ColorNames::mediumseagreen },
398 { 123 * 0x10000 + 104 * 0x100 + 238, ColorNames::mediumslateblue },
399 { 0 * 0x10000 + 250 * 0x100 + 154, ColorNames::mediumspringgreen },
400 { 72 * 0x10000 + 209 * 0x100 + 204, ColorNames::mediumturquoise },
401 { 199 * 0x10000 + 21 * 0x100 + 133, ColorNames::mediumvioletred },
402 { 25 * 0x10000 + 25 * 0x100 + 112, ColorNames::midnightblue },
403 { 245 * 0x10000 + 255 * 0x100 + 250, ColorNames::mintcream },
404 { 255 * 0x10000 + 228 * 0x100 + 225, ColorNames::mistyrose },
405 { 255 * 0x10000 + 228 * 0x100 + 181, ColorNames::moccasin },
406 { 255 * 0x10000 + 222 * 0x100 + 173, ColorNames::navajowhite },
407 { 0 * 0x10000 + 0 * 0x100 + 128, ColorNames::navy },
408 { 253 * 0x10000 + 245 * 0x100 + 230, ColorNames::oldlace },
409 { 128 * 0x10000 + 128 * 0x100 + 0, ColorNames::olive },
410 { 107 * 0x10000 + 142 * 0x100 + 35, ColorNames::olivedrab },
411 { 255 * 0x10000 + 165 * 0x100 + 0, ColorNames::orange },
412 { 255 * 0x10000 + 69 * 0x100 + 0, ColorNames::orangered },
413 { 218 * 0x10000 + 112 * 0x100 + 214, ColorNames::orchid },
414 { 238 * 0x10000 + 232 * 0x100 + 170, ColorNames::palegoldenrod },
415 { 152 * 0x10000 + 251 * 0x100 + 152, ColorNames::palegreen },
416 { 175 * 0x10000 + 238 * 0x100 + 238, ColorNames::paleturquoise },
417 { 219 * 0x10000 + 112 * 0x100 + 147, ColorNames::palevioletred },
418 { 255 * 0x10000 + 239 * 0x100 + 213, ColorNames::papayawhip },
419 { 255 * 0x10000 + 218 * 0x100 + 185, ColorNames::peachpuff },
420 { 205 * 0x10000 + 133 * 0x100 + 63, ColorNames::peru },
421 { 255 * 0x10000 + 192 * 0x100 + 203, ColorNames::pink },
422 { 221 * 0x10000 + 160 * 0x100 + 221, ColorNames::plum },
423 { 176 * 0x10000 + 224 * 0x100 + 230, ColorNames::powderblue },
424 { 128 * 0x10000 + 0 * 0x100 + 128, ColorNames::purple },
425 { 255 * 0x10000 + 0 * 0x100 + 0, ColorNames::red },
426 { 188 * 0x10000 + 143 * 0x100 + 143, ColorNames::rosybrown },
427 { 65 * 0x10000 + 105 * 0x100 + 225, ColorNames::royalblue },
428 { 139 * 0x10000 + 69 * 0x100 + 19, ColorNames::saddlebrown },
429 { 250 * 0x10000 + 128 * 0x100 + 114, ColorNames::salmon },
430 { 244 * 0x10000 + 164 * 0x100 + 96, ColorNames::sandybrown },
431 { 46 * 0x10000 + 139 * 0x100 + 87, ColorNames::seagreen },
432 { 255 * 0x10000 + 245 * 0x100 + 238, ColorNames::seashell },
433 { 160 * 0x10000 + 82 * 0x100 + 45, ColorNames::sienna },
434 { 192 * 0x10000 + 192 * 0x100 + 192, ColorNames::silver },
435 { 135 * 0x10000 + 206 * 0x100 + 235, ColorNames::skyblue },
436 { 106 * 0x10000 + 90 * 0x100 + 205, ColorNames::slateblue },
437 { 112 * 0x10000 + 128 * 0x100 + 144, ColorNames::slategray },
438 { 255 * 0x10000 + 250 * 0x100 + 250, ColorNames::snow },
439 { 0 * 0x10000 + 255 * 0x100 + 127, ColorNames::springgreen },
440 { 70 * 0x10000 + 130 * 0x100 + 180, ColorNames::steelblue },
441 { 210 * 0x10000 + 180 * 0x100 + 140, ColorNames::tan },
442 { 0 * 0x10000 + 128 * 0x100 + 128, ColorNames::teal },
443 { 216 * 0x10000 + 191 * 0x100 + 216, ColorNames::thistle },
444 { 255 * 0x10000 + 99 * 0x100 + 71, ColorNames::tomato },
445 { 64 * 0x10000 + 224 * 0x100 + 208, ColorNames::turquoise },
446 { 238 * 0x10000 + 130 * 0x100 + 238, ColorNames::violet },
447 { 245 * 0x10000 + 222 * 0x100 + 179, ColorNames::wheat },
448 { 255 * 0x10000 + 255 * 0x100 + 255, ColorNames::white },
449 { 245 * 0x10000 + 245 * 0x100 + 245, ColorNames::whitesmoke },
450 { 255 * 0x10000 + 255 * 0x100 + 0, ColorNames::yellow },
451 { 154 * 0x10000 + 205 * 0x100 + 50, ColorNames::yellowgreen },
452 { 102 * 0x10000 + 51 * 0x100 + 153, ColorNames::rebeccapurple }
455 const std::map<const char*, Color_Ptr_Const, map_cmp_str> names_to_colors
457 { ColorNames::aliceblue, &Colors::aliceblue },
458 { ColorNames::antiquewhite, &Colors::antiquewhite },
459 { ColorNames::cyan, &Colors::cyan },
460 { ColorNames::aqua, &Colors::aqua },
461 { ColorNames::aquamarine, &Colors::aquamarine },
462 { ColorNames::azure, &Colors::azure },
463 { ColorNames::beige, &Colors::beige },
464 { ColorNames::bisque, &Colors::bisque },
465 { ColorNames::black, &Colors::black },
466 { ColorNames::blanchedalmond, &Colors::blanchedalmond },
467 { ColorNames::blue, &Colors::blue },
468 { ColorNames::blueviolet, &Colors::blueviolet },
469 { ColorNames::brown, &Colors::brown },
470 { ColorNames::burlywood, &Colors::burlywood },
471 { ColorNames::cadetblue, &Colors::cadetblue },
472 { ColorNames::chartreuse, &Colors::chartreuse },
473 { ColorNames::chocolate, &Colors::chocolate },
474 { ColorNames::coral, &Colors::coral },
475 { ColorNames::cornflowerblue, &Colors::cornflowerblue },
476 { ColorNames::cornsilk, &Colors::cornsilk },
477 { ColorNames::crimson, &Colors::crimson },
478 { ColorNames::darkblue, &Colors::darkblue },
479 { ColorNames::darkcyan, &Colors::darkcyan },
480 { ColorNames::darkgoldenrod, &Colors::darkgoldenrod },
481 { ColorNames::darkgray, &Colors::darkgray },
482 { ColorNames::darkgrey, &Colors::darkgrey },
483 { ColorNames::darkgreen, &Colors::darkgreen },
484 { ColorNames::darkkhaki, &Colors::darkkhaki },
485 { ColorNames::darkmagenta, &Colors::darkmagenta },
486 { ColorNames::darkolivegreen, &Colors::darkolivegreen },
487 { ColorNames::darkorange, &Colors::darkorange },
488 { ColorNames::darkorchid, &Colors::darkorchid },
489 { ColorNames::darkred, &Colors::darkred },
490 { ColorNames::darksalmon, &Colors::darksalmon },
491 { ColorNames::darkseagreen, &Colors::darkseagreen },
492 { ColorNames::darkslateblue, &Colors::darkslateblue },
493 { ColorNames::darkslategray, &Colors::darkslategray },
494 { ColorNames::darkslategrey, &Colors::darkslategrey },
495 { ColorNames::darkturquoise, &Colors::darkturquoise },
496 { ColorNames::darkviolet, &Colors::darkviolet },
497 { ColorNames::deeppink, &Colors::deeppink },
498 { ColorNames::deepskyblue, &Colors::deepskyblue },
499 { ColorNames::dimgray, &Colors::dimgray },
500 { ColorNames::dimgrey, &Colors::dimgrey },
501 { ColorNames::dodgerblue, &Colors::dodgerblue },
502 { ColorNames::firebrick, &Colors::firebrick },
503 { ColorNames::floralwhite, &Colors::floralwhite },
504 { ColorNames::forestgreen, &Colors::forestgreen },
505 { ColorNames::magenta, &Colors::magenta },
506 { ColorNames::fuchsia, &Colors::fuchsia },
507 { ColorNames::gainsboro, &Colors::gainsboro },
508 { ColorNames::ghostwhite, &Colors::ghostwhite },
509 { ColorNames::gold, &Colors::gold },
510 { ColorNames::goldenrod, &Colors::goldenrod },
511 { ColorNames::gray, &Colors::gray },
512 { ColorNames::grey, &Colors::grey },
513 { ColorNames::green, &Colors::green },
514 { ColorNames::greenyellow, &Colors::greenyellow },
515 { ColorNames::honeydew, &Colors::honeydew },
516 { ColorNames::hotpink, &Colors::hotpink },
517 { ColorNames::indianred, &Colors::indianred },
518 { ColorNames::indigo, &Colors::indigo },
519 { ColorNames::ivory, &Colors::ivory },
520 { ColorNames::khaki, &Colors::khaki },
521 { ColorNames::lavender, &Colors::lavender },
522 { ColorNames::lavenderblush, &Colors::lavenderblush },
523 { ColorNames::lawngreen, &Colors::lawngreen },
524 { ColorNames::lemonchiffon, &Colors::lemonchiffon },
525 { ColorNames::lightblue, &Colors::lightblue },
526 { ColorNames::lightcoral, &Colors::lightcoral },
527 { ColorNames::lightcyan, &Colors::lightcyan },
528 { ColorNames::lightgoldenrodyellow, &Colors::lightgoldenrodyellow },
529 { ColorNames::lightgray, &Colors::lightgray },
530 { ColorNames::lightgrey, &Colors::lightgrey },
531 { ColorNames::lightgreen, &Colors::lightgreen },
532 { ColorNames::lightpink, &Colors::lightpink },
533 { ColorNames::lightsalmon, &Colors::lightsalmon },
534 { ColorNames::lightseagreen, &Colors::lightseagreen },
535 { ColorNames::lightskyblue, &Colors::lightskyblue },
536 { ColorNames::lightslategray, &Colors::lightslategray },
537 { ColorNames::lightslategrey, &Colors::lightslategrey },
538 { ColorNames::lightsteelblue, &Colors::lightsteelblue },
539 { ColorNames::lightyellow, &Colors::lightyellow },
540 { ColorNames::lime, &Colors::lime },
541 { ColorNames::limegreen, &Colors::limegreen },
542 { ColorNames::linen, &Colors::linen },
543 { ColorNames::maroon, &Colors::maroon },
544 { ColorNames::mediumaquamarine, &Colors::mediumaquamarine },
545 { ColorNames::mediumblue, &Colors::mediumblue },
546 { ColorNames::mediumorchid, &Colors::mediumorchid },
547 { ColorNames::mediumpurple, &Colors::mediumpurple },
548 { ColorNames::mediumseagreen, &Colors::mediumseagreen },
549 { ColorNames::mediumslateblue, &Colors::mediumslateblue },
550 { ColorNames::mediumspringgreen, &Colors::mediumspringgreen },
551 { ColorNames::mediumturquoise, &Colors::mediumturquoise },
552 { ColorNames::mediumvioletred, &Colors::mediumvioletred },
553 { ColorNames::midnightblue, &Colors::midnightblue },
554 { ColorNames::mintcream, &Colors::mintcream },
555 { ColorNames::mistyrose, &Colors::mistyrose },
556 { ColorNames::moccasin, &Colors::moccasin },
557 { ColorNames::navajowhite, &Colors::navajowhite },
558 { ColorNames::navy, &Colors::navy },
559 { ColorNames::oldlace, &Colors::oldlace },
560 { ColorNames::olive, &Colors::olive },
561 { ColorNames::olivedrab, &Colors::olivedrab },
562 { ColorNames::orange, &Colors::orange },
563 { ColorNames::orangered, &Colors::orangered },
564 { ColorNames::orchid, &Colors::orchid },
565 { ColorNames::palegoldenrod, &Colors::palegoldenrod },
566 { ColorNames::palegreen, &Colors::palegreen },
567 { ColorNames::paleturquoise, &Colors::paleturquoise },
568 { ColorNames::palevioletred, &Colors::palevioletred },
569 { ColorNames::papayawhip, &Colors::papayawhip },
570 { ColorNames::peachpuff, &Colors::peachpuff },
571 { ColorNames::peru, &Colors::peru },
572 { ColorNames::pink, &Colors::pink },
573 { ColorNames::plum, &Colors::plum },
574 { ColorNames::powderblue, &Colors::powderblue },
575 { ColorNames::purple, &Colors::purple },
576 { ColorNames::red, &Colors::red },
577 { ColorNames::rosybrown, &Colors::rosybrown },
578 { ColorNames::royalblue, &Colors::royalblue },
579 { ColorNames::saddlebrown, &Colors::saddlebrown },
580 { ColorNames::salmon, &Colors::salmon },
581 { ColorNames::sandybrown, &Colors::sandybrown },
582 { ColorNames::seagreen, &Colors::seagreen },
583 { ColorNames::seashell, &Colors::seashell },
584 { ColorNames::sienna, &Colors::sienna },
585 { ColorNames::silver, &Colors::silver },
586 { ColorNames::skyblue, &Colors::skyblue },
587 { ColorNames::slateblue, &Colors::slateblue },
588 { ColorNames::slategray, &Colors::slategray },
589 { ColorNames::slategrey, &Colors::slategrey },
590 { ColorNames::snow, &Colors::snow },
591 { ColorNames::springgreen, &Colors::springgreen },
592 { ColorNames::steelblue, &Colors::steelblue },
593 { ColorNames::tan, &Colors::tan },
594 { ColorNames::teal, &Colors::teal },
595 { ColorNames::thistle, &Colors::thistle },
596 { ColorNames::tomato, &Colors::tomato },
597 { ColorNames::turquoise, &Colors::turquoise },
598 { ColorNames::violet, &Colors::violet },
599 { ColorNames::wheat, &Colors::wheat },
600 { ColorNames::white, &Colors::white },
601 { ColorNames::whitesmoke, &Colors::whitesmoke },
602 { ColorNames::yellow, &Colors::yellow },
603 { ColorNames::yellowgreen, &Colors::yellowgreen },
604 { ColorNames::rebeccapurple, &Colors::rebeccapurple },
605 { ColorNames::transparent, &Colors::transparent }
608 Color_Ptr_Const name_to_color(const char* key)
610 auto p = names_to_colors.find(key);
611 if (p != names_to_colors.end()) {
617 Color_Ptr_Const name_to_color(const std::string& key)
619 return name_to_color(key.c_str());
622 const char* color_to_name(const int key)
624 auto p = colors_to_names.find(key);
625 if (p != colors_to_names.end()) {
631 const char* color_to_name(const double key)
633 return color_to_name((int)key);
636 const char* color_to_name(const Color& c)
638 double key = c.r() * 0x10000
641 return color_to_name(key);