Radium Engine  1.5.20
Loading...
Searching...
No Matches
Color.cpp
1// from
2// https://github.com/sammycage/lunasvg/blob/7f82e941270aad040922798c210ce0e2c1eb58aa/source/parser.cpp
3#include <Core/Utils/Color.hpp>
4
5#include <cstdint>
6#include <map>
7#include <string>
8
9namespace Ra {
10namespace Core {
11namespace Utils {
12
13static const std::map<std::string_view, uint32_t> s_colormap = {
14 { "aliceblue", 0xF0F8FF },
15 { "antiquewhite", 0xFAEBD7 },
16 { "aqua", 0x00FFFF },
17 { "aquamarine", 0x7FFFD4 },
18 { "azure", 0xF0FFFF },
19 { "beige", 0xF5F5DC },
20 { "bisque", 0xFFE4C4 },
21 { "black", 0x000000 },
22 { "blanchedalmond", 0xFFEBCD },
23 { "blue", 0x0000FF },
24 { "blueviolet", 0x8A2BE2 },
25 { "brown", 0xA52A2A },
26 { "burlywood", 0xDEB887 },
27 { "cadetblue", 0x5F9EA0 },
28 { "chartreuse", 0x7FFF00 },
29 { "chocolate", 0xD2691E },
30 { "coral", 0xFF7F50 },
31 { "cornflowerblue", 0x6495ED },
32 { "cornsilk", 0xFFF8DC },
33 { "crimson", 0xDC143C },
34 { "cyan", 0x00FFFF },
35 { "darkblue", 0x00008B },
36 { "darkcyan", 0x008B8B },
37 { "darkgoldenrod", 0xB8860B },
38 { "darkgray", 0xA9A9A9 },
39 { "darkgreen", 0x006400 },
40 { "darkgrey", 0xA9A9A9 },
41 { "darkkhaki", 0xBDB76B },
42 { "darkmagenta", 0x8B008B },
43 { "darkolivegreen", 0x556B2F },
44 { "darkorange", 0xFF8C00 },
45 { "darkorchid", 0x9932CC },
46 { "darkred", 0x8B0000 },
47 { "darksalmon", 0xE9967A },
48 { "darkseagreen", 0x8FBC8F },
49 { "darkslateblue", 0x483D8B },
50 { "darkslategray", 0x2F4F4F },
51 { "darkslategrey", 0x2F4F4F },
52 { "darkturquoise", 0x00CED1 },
53 { "darkviolet", 0x9400D3 },
54 { "deeppink", 0xFF1493 },
55 { "deepskyblue", 0x00BFFF },
56 { "dimgray", 0x696969 },
57 { "dimgrey", 0x696969 },
58 { "dodgerblue", 0x1E90FF },
59 { "firebrick", 0xB22222 },
60 { "floralwhite", 0xFFFAF0 },
61 { "forestgreen", 0x228B22 },
62 { "fuchsia", 0xFF00FF },
63 { "gainsboro", 0xDCDCDC },
64 { "ghostwhite", 0xF8F8FF },
65 { "gold", 0xFFD700 },
66 { "goldenrod", 0xDAA520 },
67 { "gray", 0x808080 },
68 { "green", 0x008000 },
69 { "greenyellow", 0xADFF2F },
70 { "grey", 0x808080 },
71 { "honeydew", 0xF0FFF0 },
72 { "hotpink", 0xFF69B4 },
73 { "indianred", 0xCD5C5C },
74 { "indigo", 0x4B0082 },
75 { "ivory", 0xFFFFF0 },
76 { "khaki", 0xF0E68C },
77 { "lavender", 0xE6E6FA },
78 { "lavenderblush", 0xFFF0F5 },
79 { "lawngreen", 0x7CFC00 },
80 { "lemonchiffon", 0xFFFACD },
81 { "lightblue", 0xADD8E6 },
82 { "lightcoral", 0xF08080 },
83 { "lightcyan", 0xE0FFFF },
84 { "lightgoldenrodyellow", 0xFAFAD2 },
85 { "lightgray", 0xD3D3D3 },
86 { "lightgreen", 0x90EE90 },
87 { "lightgrey", 0xD3D3D3 },
88 { "lightpink", 0xFFB6C1 },
89 { "lightsalmon", 0xFFA07A },
90 { "lightseagreen", 0x20B2AA },
91 { "lightskyblue", 0x87CEFA },
92 { "lightslategray", 0x778899 },
93 { "lightslategrey", 0x778899 },
94 { "lightsteelblue", 0xB0C4DE },
95 { "lightyellow", 0xFFFFE0 },
96 { "lime", 0x00FF00 },
97 { "limegreen", 0x32CD32 },
98 { "linen", 0xFAF0E6 },
99 { "magenta", 0xFF00FF },
100 { "maroon", 0x800000 },
101 { "mediumaquamarine", 0x66CDAA },
102 { "mediumblue", 0x0000CD },
103 { "mediumorchid", 0xBA55D3 },
104 { "mediumpurple", 0x9370DB },
105 { "mediumseagreen", 0x3CB371 },
106 { "mediumslateblue", 0x7B68EE },
107 { "mediumspringgreen", 0x00FA9A },
108 { "mediumturquoise", 0x48D1CC },
109 { "mediumvioletred", 0xC71585 },
110 { "midnightblue", 0x191970 },
111 { "mintcream", 0xF5FFFA },
112 { "mistyrose", 0xFFE4E1 },
113 { "moccasin", 0xFFE4B5 },
114 { "navajowhite", 0xFFDEAD },
115 { "navy", 0x000080 },
116 { "oldlace", 0xFDF5E6 },
117 { "olive", 0x808000 },
118 { "olivedrab", 0x6B8E23 },
119 { "orange", 0xFFA500 },
120 { "orangered", 0xFF4500 },
121 { "orchid", 0xDA70D6 },
122 { "palegoldenrod", 0xEEE8AA },
123 { "palegreen", 0x98FB98 },
124 { "paleturquoise", 0xAFEEEE },
125 { "palevioletred", 0xDB7093 },
126 { "papayawhip", 0xFFEFD5 },
127 { "peachpuff", 0xFFDAB9 },
128 { "peru", 0xCD853F },
129 { "pink", 0xFFC0CB },
130 { "plum", 0xDDA0DD },
131 { "powderblue", 0xB0E0E6 },
132 { "purple", 0x800080 },
133 { "rebeccapurple", 0x663399 },
134 { "red", 0xFF0000 },
135 { "rosybrown", 0xBC8F8F },
136 { "royalblue", 0x4169E1 },
137 { "saddlebrown", 0x8B4513 },
138 { "salmon", 0xFA8072 },
139 { "sandybrown", 0xF4A460 },
140 { "seagreen", 0x2E8B57 },
141 { "seashell", 0xFFF5EE },
142 { "sienna", 0xA0522D },
143 { "silver", 0xC0C0C0 },
144 { "skyblue", 0x87CEEB },
145 { "slateblue", 0x6A5ACD },
146 { "slategray", 0x708090 },
147 { "slategrey", 0x708090 },
148 { "snow", 0xFFFAFA },
149 { "springgreen", 0x00FF7F },
150 { "steelblue", 0x4682B4 },
151 { "tan", 0xD2B48C },
152 { "teal", 0x008080 },
153 { "thistle", 0xD8BFD8 },
154 { "tomato", 0xFF6347 },
155 { "turquoise", 0x40E0D0 },
156 { "violet", 0xEE82EE },
157 { "wheat", 0xF5DEB3 },
158 { "white", 0xFFFFFF },
159 { "whitesmoke", 0xF5F5F5 },
160 { "yellow", 0xFFFF00 },
161 { "yellowgreen", 0x9ACD32 } };
162
163uint32_t getNamedColorCode( std::string_view name ) {
164 auto itr = s_colormap.find( name );
165 if ( itr == s_colormap.end() ) return 0;
166 return itr->second;
167}
168} // namespace Utils
169} // namespace Core
170} // namespace Ra
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3