16#ifndef AEONGUI_COLOR_H
17#define AEONGUI_COLOR_H
26 enum CSS3Color : uint32_t
28 aliceblue = 0xfff0f8ff,
29 antiquewhite = 0xfffaebd7,
31 aquamarine = 0xff7fffd4,
36 blanchedalmond = 0xffffebcd,
38 blueviolet = 0xff8a2be2,
40 burlywood = 0xffdeb887,
41 cadetblue = 0xff5f9ea0,
42 chartreuse = 0xff7fff00,
43 chocolate = 0xffd2691e,
45 cornflowerblue = 0xff6495ed,
46 cornsilk = 0xfffff8dc,
49 darkblue = 0xff00008b,
50 darkcyan = 0xff008b8b,
51 darkgoldenrod = 0xffb8860b,
52 darkgray = 0xffa9a9a9,
53 darkgreen = 0xff006400,
54 darkgrey = 0xffa9a9a9,
55 darkkhaki = 0xffbdb76b,
56 darkmagenta = 0xff8b008b,
57 darkolivegreen = 0xff556b2f,
58 darkorange = 0xffff8c00,
59 darkorchid = 0xff9932cc,
61 darksalmon = 0xffe9967a,
62 darkseagreen = 0xff8fbc8f,
63 darkslateblue = 0xff483d8b,
64 darkslategray = 0xff2f4f4f,
65 darkslategrey = 0xff2f4f4f,
66 darkturquoise = 0xff00ced1,
67 darkviolet = 0xff9400d3,
68 deeppink = 0xffff1493,
69 deepskyblue = 0xff00bfff,
72 dodgerblue = 0xff1e90ff,
73 firebrick = 0xffb22222,
74 floralwhite = 0xfffffaf0,
75 forestgreen = 0xff228b22,
77 gainsboro = 0xffdcdcdc,
78 ghostwhite = 0xfff8f8ff,
80 goldenrod = 0xffdaa520,
84 greenyellow = 0xffadff2f,
85 honeydew = 0xfff0fff0,
87 indianred = 0xffcd5c5c,
91 lavender = 0xffe6e6fa,
92 lavenderblush = 0xfffff0f5,
93 lawngreen = 0xff7cfc00,
94 lemonchiffon = 0xfffffacd,
95 lightblue = 0xffadd8e6,
96 lightcoral = 0xfff08080,
97 lightcyan = 0xffe0ffff,
98 lightgoldenrodyellow = 0xfffafad2,
99 lightgray = 0xffd3d3d3,
100 lightgreen = 0xff90ee90,
101 lightgrey = 0xffd3d3d3,
102 lightpink = 0xffffb6c1,
103 lightsalmon = 0xffffa07a,
104 lightseagreen = 0xff20b2aa,
105 lightskyblue = 0xff87cefa,
106 lightslategray = 0xff778899,
107 lightslategrey = 0xff778899,
108 lightsteelblue = 0xffb0c4de,
109 lightyellow = 0xffffffe0,
111 limegreen = 0xff32cd32,
113 magenta = 0xffff00ff,
115 mediumaquamarine = 0xff66cdaa,
116 mediumblue = 0xff0000cd,
117 mediumorchid = 0xffba55d3,
118 mediumpurple = 0xff9370db,
119 mediumseagreen = 0xff3cb371,
120 mediumslateblue = 0xff7b68ee,
121 mediumspringgreen = 0xff00fa9a,
122 mediumturquoise = 0xff48d1cc,
123 mediumvioletred = 0xffc71585,
124 midnightblue = 0xff191970,
125 mintcream = 0xfff5fffa,
126 mistyrose = 0xffffe4e1,
127 moccasin = 0xffffe4b5,
128 navajowhite = 0xffffdead,
130 oldlace = 0xfffdf5e6,
132 olivedrab = 0xff6b8e23,
134 orangered = 0xffff4500,
136 palegoldenrod = 0xffeee8aa,
137 palegreen = 0xff98fb98,
138 paleturquoise = 0xffafeeee,
139 palevioletred = 0xffdb7093,
140 papayawhip = 0xffffefd5,
141 peachpuff = 0xffffdab9,
145 powderblue = 0xffb0e0e6,
148 rosybrown = 0xffbc8f8f,
149 royalblue = 0xff4169e1,
150 saddlebrown = 0xff8b4513,
152 sandybrown = 0xfff4a460,
153 seagreen = 0xff2e8b57,
154 seashell = 0xfffff5ee,
157 skyblue = 0xff87ceeb,
158 slateblue = 0xff6a5acd,
159 slategray = 0xff708090,
160 slategrey = 0xff708090,
162 springgreen = 0xff00ff7f,
163 steelblue = 0xff4682b4,
166 thistle = 0xffd8bfd8,
168 transparent = 0x00000000,
169 turquoise = 0xff40e0d0,
173 whitesmoke = 0xfff5f5f5,
175 yellowgreen = 0xff9acd32
190 DLL
static bool IsColor (
const std::string& value, uint32_t* color_value =
nullptr );
197 DLL
explicit Color ( uint32_t value );
202 DLL Color (
const std::string& value );
209 DLL Color ( uint8_t
A, uint8_t
R, uint8_t
G, uint8_t
B );
215 DLL
void Blend ( Color src );
220 DLL
double R()
const;
224 DLL
double G()
const;
228 DLL
double B()
const;
232 DLL
double A()
const;
254 using none = std::monostate;
256 using ColorAttr = std::variant<none, Color>;
std::string ToString() const
Convert the color to a CSS-style string representation.
Definition Color.cpp:280
uint32_t bgra
32 bit Unsigned integer color value.
Definition Color.hpp:237
double G() const
Get green component as a double in [0.0, 1.0].
Definition Color.cpp:241
double B() const
Get blue component as a double in [0.0, 1.0].
Definition Color.cpp:245
double A() const
Get alpha component as a double in [0.0, 1.0].
Definition Color.cpp:249
void Blend(Color src)
Blends the color with the incoming source color. To better handle transparency the blend function use...
Definition Color.cpp:254
double R() const
Get red component as a double in [0.0, 1.0].
Definition Color.cpp:237
uint8_t a
Alpha color element.
Definition Color.hpp:249
uint8_t r
Red color element.
Definition Color.hpp:248
static bool IsColor(const std::string &value, uint32_t *color_value=nullptr)
Check whether a string represents a valid CSS color.
Definition Color.cpp:185
uint8_t g
Green color element.
Definition Color.hpp:247
uint8_t b
Blue color element.
Definition Color.hpp:246
static const std::regex ColorRegex
Regex used to parse CSS color strings.
Definition Color.hpp:192