Skip to main content

Colors.ixx File

Standard color constants as vec4f (RGBA). More...

Included Headers

#include <helios.math.types>

Namespaces Index

namespacehelios
namespaceutil

Utility functions and helper classes. More...

Classes Index

structColors

Standard color palette providing commonly used colors as vec4f (RGBA). More...

Description

Standard color constants as vec4f (RGBA).

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file Colors.ixx
3 * @brief Standard color constants as vec4f (RGBA).
4 */
5export module helios.util.Colors;
6
7import helios.math.types;
8
9export namespace helios::util {
10
11 /**
12 * @brief Standard color palette providing commonly used colors as vec4f (RGBA).
13 *
14 * All colors are defined in normalized RGBA format with components in [0.0, 1.0].
15 * Alpha is set to 1 (fully opaque) by default.
16 */
17 struct Colors {
18
19 // =====================================================================
20 // Basic Colors
21 // =====================================================================
22
23 /** @brief Pure black (#000000) */
24 static constexpr helios::math::vec4f Black{0.0f, 0.0f, 0.0f, 1.0f};
25
26 /** @brief Pure white (#FFFFFF) */
27 static constexpr helios::math::vec4f White{1.0f, 1.0f, 1.0f, 1.0f};
28
29 /** @brief Pure red (#FF0000) */
30 static constexpr helios::math::vec4f Red{1.0f, 0.0f, 0.0f, 1.0f};
31
32 /** @brief Pure green (#00FF00) */
33 static constexpr helios::math::vec4f Green{0.0f, 1.0f, 0.0f, 1.0f};
34
35 /** @brief Pure blue (#0000FF) */
36 static constexpr helios::math::vec4f Blue{0.0f, 0.0f, 1.0f, 1.0f};
37
38 /** @brief Yellow (#FFFF00) */
39 static constexpr helios::math::vec4f Yellow{1.0f, 1.0f, 0.0f, 1.0f};
40
41 /** @brief Cyan / Aqua (#00FFFF) */
42 static constexpr helios::math::vec4f Cyan{0.0f, 1.0f, 1.0f, 1.0f};
43
44 /** @brief Magenta / Fuchsia (#FF00FF) */
45 static constexpr helios::math::vec4f Magenta{1.0f, 0.0f, 1.0f, 1.0f};
46
47 // =====================================================================
48 // Grayscale
49 // =====================================================================
50
51 /** @brief Light gray (#C0C0C0) */
52 static constexpr helios::math::vec4f LightGray{0.75f, 0.75f, 0.75f, 1.0f};
53
54 /** @brief Gray (#808080) */
55 static constexpr helios::math::vec4f Gray{0.5f, 0.5f, 0.5f, 1.0f};
56
57 /** @brief Dark gray (#404040) */
58 static constexpr helios::math::vec4f DarkGray{0.25f, 0.25f, 0.25f, 1.0f};
59
60 // =====================================================================
61 // Reds / Warm Colors
62 // =====================================================================
63
64 /** @brief Dark red (#8B0000) */
65 static constexpr helios::math::vec4f DarkRed{0.545f, 0.0f, 0.0f, 1.0f};
66
67 /** @brief Crimson (#DC143C) */
68 static constexpr helios::math::vec4f Crimson{0.863f, 0.078f, 0.235f, 1.0f};
69
70 /** @brief Firebrick (#B22222) */
71 static constexpr helios::math::vec4f Firebrick{0.698f, 0.133f, 0.133f, 1.0f};
72
73 /** @brief Tomato (#FF6347) */
74 static constexpr helios::math::vec4f Tomato{1.0f, 0.388f, 0.278f, 1.0f};
75
76 /** @brief Coral (#FF7F50) */
77 static constexpr helios::math::vec4f Coral{1.0f, 0.498f, 0.314f, 1.0f};
78
79 /** @brief Indian Red (#CD5C5C) */
80 static constexpr helios::math::vec4f IndianRed{0.804f, 0.361f, 0.361f, 1.0f};
81
82 /** @brief Salmon (#FA8072) */
83 static constexpr helios::math::vec4f Salmon{0.980f, 0.502f, 0.447f, 1.0f};
84
85 /** @brief Light Salmon (#FFA07A) */
86 static constexpr helios::math::vec4f LightSalmon{1.0f, 0.627f, 0.478f, 1.0f};
87
88 // =====================================================================
89 // Oranges
90 // =====================================================================
91
92 /** @brief Orange (#FFA500) */
93 static constexpr helios::math::vec4f Orange{1.0f, 0.647f, 0.0f, 1.0f};
94
95 /** @brief Dark Orange (#FF8C00) */
96 static constexpr helios::math::vec4f DarkOrange{1.0f, 0.549f, 0.0f, 1.0f};
97
98 /** @brief Orange Red (#FF4500) */
99 static constexpr helios::math::vec4f OrangeRed{1.0f, 0.271f, 0.0f, 1.0f};
100
101 // =====================================================================
102 // Yellows
103 // =====================================================================
104
105 /** @brief Gold (#FFD700) */
106 static constexpr helios::math::vec4f Gold{1.0f, 0.843f, 0.0f, 1.0f};
107
108 /** @brief Light Yellow (#FFFFE0) */
109 static constexpr helios::math::vec4f LightYellow{1.0f, 1.0f, 0.878f, 1.0f};
110
111 /** @brief Lemon Chiffon (#FFFACD) */
112 static constexpr helios::math::vec4f LemonChiffon{1.0f, 0.980f, 0.804f, 1.0f};
113
114 /** @brief Khaki (#F0E68C) */
115 static constexpr helios::math::vec4f Khaki{0.941f, 0.902f, 0.549f, 1.0f};
116
117 // =====================================================================
118 // Greens
119 // =====================================================================
120
121 /** @brief Dark Green (#006400) */
122 static constexpr helios::math::vec4f DarkGreen{0.0f, 0.392f, 0.0f, 1.0f};
123
124 /** @brief Forest Green (#228B22) */
125 static constexpr helios::math::vec4f ForestGreen{0.133f, 0.545f, 0.133f, 1.0f};
126
127 /** @brief Lime Green (#32CD32) */
128 static constexpr helios::math::vec4f LimeGreen{0.196f, 0.804f, 0.196f, 1.0f};
129
130 /** @brief Light Green (#90EE90) */
131 static constexpr helios::math::vec4f LightGreen{0.565f, 0.933f, 0.565f, 1.0f};
132
133 /** @brief Pale Green (#98FB98) */
134 static constexpr helios::math::vec4f PaleGreen{0.596f, 0.984f, 0.596f, 1.0f};
135
136 /** @brief Spring Green (#00FF7F) */
137 static constexpr helios::math::vec4f SpringGreen{0.0f, 1.0f, 0.498f, 1.0f};
138
139 /** @brief Sea Green (#2E8B57) */
140 static constexpr helios::math::vec4f SeaGreen{0.180f, 0.545f, 0.341f, 1.0f};
141
142 /** @brief Olive (#808000) */
143 static constexpr helios::math::vec4f Olive{0.502f, 0.502f, 0.0f, 1.0f};
144
145 /** @brief Olive Drab (#6B8E23) */
146 static constexpr helios::math::vec4f OliveDrab{0.420f, 0.557f, 0.137f, 1.0f};
147
148 // =====================================================================
149 // Blues
150 // =====================================================================
151
152 /** @brief Navy (#000080) */
153 static constexpr helios::math::vec4f Navy{0.0f, 0.0f, 0.502f, 1.0f};
154
155 /** @brief Dark Blue (#00008B) */
156 static constexpr helios::math::vec4f DarkBlue{0.0f, 0.0f, 0.545f, 1.0f};
157
158 /** @brief Medium Blue (#0000CD) */
159 static constexpr helios::math::vec4f MediumBlue{0.0f, 0.0f, 0.804f, 1.0f};
160
161 /** @brief Royal Blue (#4169E1) */
162 static constexpr helios::math::vec4f RoyalBlue{0.255f, 0.412f, 0.882f, 1.0f};
163
164 /** @brief Cornflower Blue (#6495ED) */
165 static constexpr helios::math::vec4f CornflowerBlue{0.392f, 0.584f, 0.929f, 1.0f};
166
167 /** @brief Dodger Blue (#1E90FF) */
168 static constexpr helios::math::vec4f DodgerBlue{0.118f, 0.565f, 1.0f, 1.0f};
169
170 /** @brief Deep Sky Blue (#00BFFF) */
171 static constexpr helios::math::vec4f DeepSkyBlue{0.0f, 0.749f, 1.0f, 1.0f};
172
173 /** @brief Sky Blue (#87CEEB) */
174 static constexpr helios::math::vec4f SkyBlue{0.529f, 0.808f, 0.922f, 1.0f};
175
176 /** @brief Light Sky Blue (#87CEFA) */
177 static constexpr helios::math::vec4f LightSkyBlue{0.529f, 0.808f, 0.980f, 1.0f};
178
179 /** @brief Light Blue (#ADD8E6) */
180 static constexpr helios::math::vec4f LightBlue{0.678f, 0.847f, 0.902f, 1.0f};
181
182 /** @brief Steel Blue (#4682B4) */
183 static constexpr helios::math::vec4f SteelBlue{0.275f, 0.510f, 0.706f, 1.0f};
184
185 /** @brief Powder Blue (#B0E0E6) */
186 static constexpr helios::math::vec4f PowderBlue{0.690f, 0.878f, 0.902f, 1.0f};
187
188 // =====================================================================
189 // Cyans / Teals
190 // =====================================================================
191
192 /** @brief Teal (#008080) */
193 static constexpr helios::math::vec4f Teal{0.0f, 0.502f, 0.502f, 1.0f};
194
195 /** @brief Dark Cyan (#008B8B) */
196 static constexpr helios::math::vec4f DarkCyan{0.0f, 0.545f, 0.545f, 1.0f};
197
198 /** @brief Turquoise (#40E0D0) */
199 static constexpr helios::math::vec4f Turquoise{0.251f, 0.878f, 0.816f, 1.0f};
200
201 /** @brief Aquamarine (#7FFFD4) */
202 static constexpr helios::math::vec4f Aquamarine{0.498f, 1.0f, 0.831f, 1.0f};
203
204 // =====================================================================
205 // Purples / Violets
206 // =====================================================================
207
208 /** @brief Purple (#800080) */
209 static constexpr helios::math::vec4f Purple{0.502f, 0.0f, 0.502f, 1.0f};
210
211 /** @brief Indigo (#4B0082) */
212 static constexpr helios::math::vec4f Indigo{0.294f, 0.0f, 0.510f, 1.0f};
213
214 /** @brief Dark Violet (#9400D3) */
215 static constexpr helios::math::vec4f DarkViolet{0.580f, 0.0f, 0.827f, 1.0f};
216
217 /** @brief Dark Orchid (#9932CC) */
218 static constexpr helios::math::vec4f DarkOrchid{0.600f, 0.196f, 0.800f, 1.0f};
219
220 /** @brief Medium Purple (#9370DB) */
221 static constexpr helios::math::vec4f MediumPurple{0.576f, 0.439f, 0.859f, 1.0f};
222
223 /** @brief Violet (#EE82EE) */
224 static constexpr helios::math::vec4f Violet{0.933f, 0.510f, 0.933f, 1.0f};
225
226 /** @brief Orchid (#DA70D6) */
227 static constexpr helios::math::vec4f Orchid{0.855f, 0.439f, 0.839f, 1.0f};
228
229 /** @brief Plum (#DDA0DD) */
230 static constexpr helios::math::vec4f Plum{0.867f, 0.627f, 0.867f, 1.0f};
231
232 /** @brief Lavender (#E6E6FA) */
233 static constexpr helios::math::vec4f Lavender{0.902f, 0.902f, 0.980f, 1.0f};
234
235 // =====================================================================
236 // Pinks
237 // =====================================================================
238
239 /** @brief Pink (#FFC0CB) */
240 static constexpr helios::math::vec4f Pink{1.0f, 0.753f, 0.796f, 1.0f};
241
242 /** @brief Light Pink (#FFB6C1) */
243 static constexpr helios::math::vec4f LightPink{1.0f, 0.714f, 0.757f, 1.0f};
244
245 /** @brief Hot Pink (#FF69B4) */
246 static constexpr helios::math::vec4f HotPink{1.0f, 0.412f, 0.706f, 1.0f};
247
248 /** @brief Deep Pink (#FF1493) */
249 static constexpr helios::math::vec4f DeepPink{1.0f, 0.078f, 0.576f, 1.0f};
250
251 // =====================================================================
252 // Browns
253 // =====================================================================
254
255 /** @brief Brown (#A52A2A) */
256 static constexpr helios::math::vec4f Brown{0.647f, 0.165f, 0.165f, 1.0f};
257
258 /** @brief Maroon (#800000) */
259 static constexpr helios::math::vec4f Maroon{0.502f, 0.0f, 0.0f, 1.0f};
260
261 /** @brief Sienna (#A0522D) */
262 static constexpr helios::math::vec4f Sienna{0.627f, 0.322f, 0.176f, 1.0f};
263
264 /** @brief Saddle Brown (#8B4513) */
265 static constexpr helios::math::vec4f SaddleBrown{0.545f, 0.271f, 0.075f, 1.0f};
266
267 /** @brief Chocolate (#D2691E) */
268 static constexpr helios::math::vec4f Chocolate{0.824f, 0.412f, 0.118f, 1.0f};
269
270 /** @brief Peru (#CD853F) */
271 static constexpr helios::math::vec4f Peru{0.804f, 0.522f, 0.247f, 1.0f};
272
273 /** @brief Sandy Brown (#F4A460) */
274 static constexpr helios::math::vec4f SandyBrown{0.957f, 0.643f, 0.376f, 1.0f};
275
276 /** @brief Tan (#D2B48C) */
277 static constexpr helios::math::vec4f Tan{0.824f, 0.706f, 0.549f, 1.0f};
278
279 /** @brief Burlywood (#DEB887) */
280 static constexpr helios::math::vec4f Burlywood{0.871f, 0.722f, 0.529f, 1.0f};
281
282 /** @brief Wheat (#F5DEB3) */
283 static constexpr helios::math::vec4f Wheat{0.961f, 0.871f, 0.702f, 1.0f};
284
285 // =====================================================================
286 // Whites / Light Colors
287 // =====================================================================
288
289 /** @brief Snow (#FFFAFA) */
290 static constexpr helios::math::vec4f Snow{1.0f, 0.980f, 0.980f, 1.0f};
291
292 /** @brief Ivory (#FFFFF0) */
293 static constexpr helios::math::vec4f Ivory{1.0f, 1.0f, 0.941f, 1.0f};
294
295 /** @brief Linen (#FAF0E6) */
296 static constexpr helios::math::vec4f Linen{0.980f, 0.941f, 0.902f, 1.0f};
297
298 /** @brief Beige (#F5F5DC) */
299 static constexpr helios::math::vec4f Beige{0.961f, 0.961f, 0.863f, 1.0f};
300
301 /** @brief Antique White (#FAEBD7) */
302 static constexpr helios::math::vec4f AntiqueWhite{0.980f, 0.922f, 0.843f, 1.0f};
303
304 /** @brief Mint Cream (#F5FFFA) */
305 static constexpr helios::math::vec4f MintCream{0.961f, 1.0f, 0.980f, 1.0f};
306
307 /** @brief Azure (#F0FFFF) */
308 static constexpr helios::math::vec4f Azure{0.941f, 1.0f, 1.0f, 1.0f};
309
310 /** @brief Alice Blue (#F0F8FF) */
311 static constexpr helios::math::vec4f AliceBlue{0.941f, 0.973f, 1.0f, 1.0f};
312
313 /** @brief Ghost White (#F8F8FF) */
314 static constexpr helios::math::vec4f GhostWhite{0.973f, 0.973f, 1.0f, 1.0f};
315
316 /** @brief White Smoke (#F5F5F5) */
317 static constexpr helios::math::vec4f WhiteSmoke{0.961f, 0.961f, 0.961f, 1.0f};
318
319 // =====================================================================
320 // Special / Transparent
321 // =====================================================================
322
323 /** @brief Fully transparent (all components 0) */
324 static constexpr helios::math::vec4f Transparent{0.0f, 0.0f, 0.0f, 0.0f};
325
326 /** @brief Cornsilk (#FFF8DC) */
327 static constexpr helios::math::vec4f Cornsilk{1.0f, 0.973f, 0.863f, 1.0f};
328
329 /** @brief Honeydew (#F0FFF0) */
330 static constexpr helios::math::vec4f Honeydew{0.941f, 1.0f, 0.941f, 1.0f};
331
332 /** @brief Seashell (#FFF5EE) */
333 static constexpr helios::math::vec4f Seashell{1.0f, 0.961f, 0.933f, 1.0f};
334
335 /** @brief Floral White (#FFFAF0) */
336 static constexpr helios::math::vec4f FloralWhite{1.0f, 0.980f, 0.941f, 1.0f};
337
338 // =====================================================================
339 // Utility Methods
340 // =====================================================================
341
342 /**
343 * @brief Creates a color from RGB byte values (0-255).
344 * @param r Red component (0-255).
345 * @param g Green component (0-255).
346 * @param b Blue component (0-255).
347 * @param a Alpha component (0-255), defaults to 255 (opaque).
348 * @return Normalized vec4f color.
349 */
350 static constexpr helios::math::vec4f fromRGB(int r, int g, int b, int a = 255) {
352 static_cast<float>(r) / 255.0f,
353 static_cast<float>(g) / 255.0f,
354 static_cast<float>(b) / 255.0f,
355 static_cast<float>(a) / 255.0f
356 };
357 }
358
359 /**
360 * @brief Creates a color from a 32-bit hex value (0xRRGGBB or 0xRRGGBBAA).
361 * @param hex The hex color value.
362 * @param hasAlpha If true, expects 0xRRGGBBAA format; otherwise 0xRRGGBB with alpha = 1.0.
363 * @return Normalized vec4f color.
364 */
365 static constexpr helios::math::vec4f fromHex(unsigned int hex, bool hasAlpha = false) {
366 if (hasAlpha) {
368 static_cast<float>((hex >> 24) & 0xFF) / 255.0f,
369 static_cast<float>((hex >> 16) & 0xFF) / 255.0f,
370 static_cast<float>((hex >> 8) & 0xFF) / 255.0f,
371 static_cast<float>(hex & 0xFF) / 255.0f
372 };
373 }
375 static_cast<float>((hex >> 16) & 0xFF) / 255.0f,
376 static_cast<float>((hex >> 8) & 0xFF) / 255.0f,
377 static_cast<float>(hex & 0xFF) / 255.0f,
378 1.0f
379 };
380 }
381
382 /**
383 * @brief Creates a grayscale color.
384 * @param value The gray value (0.0 = black, 1 = white).
385 * @param alpha The alpha value (defaults to 1.0).
386 * @return Grayscale vec4f color.
387 */
388 static constexpr helios::math::vec4f grayscale(float value, float alpha = 1.0f) {
389 return helios::math::vec4f{value, value, value, alpha};
390 }
391
392 /**
393 * @brief Creates a color with modified alpha.
394 * @param color The source color.
395 * @param alpha The new alpha value.
396 * @return Color with modified alpha.
397 */
398 static constexpr helios::math::vec4f withAlpha(const helios::math::vec4f& color, float alpha) {
399 return helios::math::vec4f{color[0], color[1], color[2], alpha};
400 }
401 };
402
403}
404

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.