Skip to main content

Colors.ixx File

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

Included Headers

#include <helios.math.types>

Namespaces Index

namespacehelios
namespaceengine
namespaceutil

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
5export module helios.engine.util.Colors;
6
7import helios.math.types;
8
9export namespace helios::engine::util {
10
17 struct Colors {
18
19 // =====================================================================
20 // Basic Colors
21 // =====================================================================
22
24 static constexpr helios::math::vec4f Black{0.0f, 0.0f, 0.0f, 1.0f};
25
27 static constexpr helios::math::vec4f White{1.0f, 1.0f, 1.0f, 1.0f};
28
30 static constexpr helios::math::vec4f Red{1.0f, 0.0f, 0.0f, 1.0f};
31
33 static constexpr helios::math::vec4f Green{0.0f, 1.0f, 0.0f, 1.0f};
34
36 static constexpr helios::math::vec4f Blue{0.0f, 0.0f, 1.0f, 1.0f};
37
39 static constexpr helios::math::vec4f Yellow{1.0f, 1.0f, 0.0f, 1.0f};
40
42 static constexpr helios::math::vec4f Cyan{0.0f, 1.0f, 1.0f, 1.0f};
43
45 static constexpr helios::math::vec4f Magenta{1.0f, 0.0f, 1.0f, 1.0f};
46
47 // =====================================================================
48 // Grayscale
49 // =====================================================================
50
52 static constexpr helios::math::vec4f LightGray{0.75f, 0.75f, 0.75f, 1.0f};
53
55 static constexpr helios::math::vec4f Gray{0.5f, 0.5f, 0.5f, 1.0f};
56
58 static constexpr helios::math::vec4f DarkGray{0.25f, 0.25f, 0.25f, 1.0f};
59
60 // =====================================================================
61 // Reds / Warm Colors
62 // =====================================================================
63
65 static constexpr helios::math::vec4f DarkRed{0.545f, 0.0f, 0.0f, 1.0f};
66
68 static constexpr helios::math::vec4f Crimson{0.863f, 0.078f, 0.235f, 1.0f};
69
71 static constexpr helios::math::vec4f Firebrick{0.698f, 0.133f, 0.133f, 1.0f};
72
74 static constexpr helios::math::vec4f Tomato{1.0f, 0.388f, 0.278f, 1.0f};
75
77 static constexpr helios::math::vec4f Coral{1.0f, 0.498f, 0.314f, 1.0f};
78
80 static constexpr helios::math::vec4f IndianRed{0.804f, 0.361f, 0.361f, 1.0f};
81
83 static constexpr helios::math::vec4f Salmon{0.980f, 0.502f, 0.447f, 1.0f};
84
86 static constexpr helios::math::vec4f LightSalmon{1.0f, 0.627f, 0.478f, 1.0f};
87
88 // =====================================================================
89 // Oranges
90 // =====================================================================
91
93 static constexpr helios::math::vec4f Orange{1.0f, 0.647f, 0.0f, 1.0f};
94
96 static constexpr helios::math::vec4f DarkOrange{1.0f, 0.549f, 0.0f, 1.0f};
97
99 static constexpr helios::math::vec4f OrangeRed{1.0f, 0.271f, 0.0f, 1.0f};
100
101 // =====================================================================
102 // Yellows
103 // =====================================================================
104
106 static constexpr helios::math::vec4f Gold{1.0f, 0.843f, 0.0f, 1.0f};
107
109 static constexpr helios::math::vec4f LightYellow{1.0f, 1.0f, 0.878f, 1.0f};
110
112 static constexpr helios::math::vec4f LemonChiffon{1.0f, 0.980f, 0.804f, 1.0f};
113
115 static constexpr helios::math::vec4f Khaki{0.941f, 0.902f, 0.549f, 1.0f};
116
117 // =====================================================================
118 // Greens
119 // =====================================================================
120
122 static constexpr helios::math::vec4f DarkGreen{0.0f, 0.392f, 0.0f, 1.0f};
123
125 static constexpr helios::math::vec4f ForestGreen{0.133f, 0.545f, 0.133f, 1.0f};
126
128 static constexpr helios::math::vec4f LimeGreen{0.196f, 0.804f, 0.196f, 1.0f};
129
131 static constexpr helios::math::vec4f LightGreen{0.565f, 0.933f, 0.565f, 1.0f};
132
134 static constexpr helios::math::vec4f PaleGreen{0.596f, 0.984f, 0.596f, 1.0f};
135
137 static constexpr helios::math::vec4f SpringGreen{0.0f, 1.0f, 0.498f, 1.0f};
138
140 static constexpr helios::math::vec4f SeaGreen{0.180f, 0.545f, 0.341f, 1.0f};
141
143 static constexpr helios::math::vec4f Olive{0.502f, 0.502f, 0.0f, 1.0f};
144
146 static constexpr helios::math::vec4f OliveDrab{0.420f, 0.557f, 0.137f, 1.0f};
147
148 // =====================================================================
149 // Blues
150 // =====================================================================
151
153 static constexpr helios::math::vec4f Navy{0.0f, 0.0f, 0.502f, 1.0f};
154
156 static constexpr helios::math::vec4f DarkBlue{0.0f, 0.0f, 0.545f, 1.0f};
157
159 static constexpr helios::math::vec4f MediumBlue{0.0f, 0.0f, 0.804f, 1.0f};
160
162 static constexpr helios::math::vec4f RoyalBlue{0.255f, 0.412f, 0.882f, 1.0f};
163
165 static constexpr helios::math::vec4f CornflowerBlue{0.392f, 0.584f, 0.929f, 1.0f};
166
168 static constexpr helios::math::vec4f DodgerBlue{0.118f, 0.565f, 1.0f, 1.0f};
169
171 static constexpr helios::math::vec4f DeepSkyBlue{0.0f, 0.749f, 1.0f, 1.0f};
172
174 static constexpr helios::math::vec4f SkyBlue{0.529f, 0.808f, 0.922f, 1.0f};
175
177 static constexpr helios::math::vec4f LightSkyBlue{0.529f, 0.808f, 0.980f, 1.0f};
178
180 static constexpr helios::math::vec4f LightBlue{0.678f, 0.847f, 0.902f, 1.0f};
181
183 static constexpr helios::math::vec4f SteelBlue{0.275f, 0.510f, 0.706f, 1.0f};
184
186 static constexpr helios::math::vec4f PowderBlue{0.690f, 0.878f, 0.902f, 1.0f};
187
188 // =====================================================================
189 // Cyans / Teals
190 // =====================================================================
191
193 static constexpr helios::math::vec4f Teal{0.0f, 0.502f, 0.502f, 1.0f};
194
196 static constexpr helios::math::vec4f DarkCyan{0.0f, 0.545f, 0.545f, 1.0f};
197
199 static constexpr helios::math::vec4f Turquoise{0.251f, 0.878f, 0.816f, 1.0f};
200
202 static constexpr helios::math::vec4f Aquamarine{0.498f, 1.0f, 0.831f, 1.0f};
203
204 // =====================================================================
205 // Purples / Violets
206 // =====================================================================
207
209 static constexpr helios::math::vec4f Purple{0.502f, 0.0f, 0.502f, 1.0f};
210
212 static constexpr helios::math::vec4f Indigo{0.294f, 0.0f, 0.510f, 1.0f};
213
215 static constexpr helios::math::vec4f DarkViolet{0.580f, 0.0f, 0.827f, 1.0f};
216
218 static constexpr helios::math::vec4f DarkOrchid{0.600f, 0.196f, 0.800f, 1.0f};
219
221 static constexpr helios::math::vec4f MediumPurple{0.576f, 0.439f, 0.859f, 1.0f};
222
224 static constexpr helios::math::vec4f Violet{0.933f, 0.510f, 0.933f, 1.0f};
225
227 static constexpr helios::math::vec4f Orchid{0.855f, 0.439f, 0.839f, 1.0f};
228
230 static constexpr helios::math::vec4f Plum{0.867f, 0.627f, 0.867f, 1.0f};
231
233 static constexpr helios::math::vec4f Lavender{0.902f, 0.902f, 0.980f, 1.0f};
234
235 // =====================================================================
236 // Pinks
237 // =====================================================================
238
240 static constexpr helios::math::vec4f Pink{1.0f, 0.753f, 0.796f, 1.0f};
241
243 static constexpr helios::math::vec4f LightPink{1.0f, 0.714f, 0.757f, 1.0f};
244
246 static constexpr helios::math::vec4f HotPink{1.0f, 0.412f, 0.706f, 1.0f};
247
249 static constexpr helios::math::vec4f DeepPink{1.0f, 0.078f, 0.576f, 1.0f};
250
251 // =====================================================================
252 // Browns
253 // =====================================================================
254
256 static constexpr helios::math::vec4f Brown{0.647f, 0.165f, 0.165f, 1.0f};
257
259 static constexpr helios::math::vec4f Maroon{0.502f, 0.0f, 0.0f, 1.0f};
260
262 static constexpr helios::math::vec4f Sienna{0.627f, 0.322f, 0.176f, 1.0f};
263
265 static constexpr helios::math::vec4f SaddleBrown{0.545f, 0.271f, 0.075f, 1.0f};
266
268 static constexpr helios::math::vec4f Chocolate{0.824f, 0.412f, 0.118f, 1.0f};
269
271 static constexpr helios::math::vec4f Peru{0.804f, 0.522f, 0.247f, 1.0f};
272
274 static constexpr helios::math::vec4f SandyBrown{0.957f, 0.643f, 0.376f, 1.0f};
275
277 static constexpr helios::math::vec4f Tan{0.824f, 0.706f, 0.549f, 1.0f};
278
280 static constexpr helios::math::vec4f Burlywood{0.871f, 0.722f, 0.529f, 1.0f};
281
283 static constexpr helios::math::vec4f Wheat{0.961f, 0.871f, 0.702f, 1.0f};
284
285 // =====================================================================
286 // Whites / Light Colors
287 // =====================================================================
288
290 static constexpr helios::math::vec4f Snow{1.0f, 0.980f, 0.980f, 1.0f};
291
293 static constexpr helios::math::vec4f Ivory{1.0f, 1.0f, 0.941f, 1.0f};
294
296 static constexpr helios::math::vec4f Linen{0.980f, 0.941f, 0.902f, 1.0f};
297
299 static constexpr helios::math::vec4f Beige{0.961f, 0.961f, 0.863f, 1.0f};
300
302 static constexpr helios::math::vec4f AntiqueWhite{0.980f, 0.922f, 0.843f, 1.0f};
303
305 static constexpr helios::math::vec4f MintCream{0.961f, 1.0f, 0.980f, 1.0f};
306
308 static constexpr helios::math::vec4f Azure{0.941f, 1.0f, 1.0f, 1.0f};
309
311 static constexpr helios::math::vec4f AliceBlue{0.941f, 0.973f, 1.0f, 1.0f};
312
314 static constexpr helios::math::vec4f GhostWhite{0.973f, 0.973f, 1.0f, 1.0f};
315
317 static constexpr helios::math::vec4f WhiteSmoke{0.961f, 0.961f, 0.961f, 1.0f};
318
319 // =====================================================================
320 // Special / Transparent
321 // =====================================================================
322
324 static constexpr helios::math::vec4f Transparent{0.0f, 0.0f, 0.0f, 0.0f};
325
327 static constexpr helios::math::vec4f Cornsilk{1.0f, 0.973f, 0.863f, 1.0f};
328
330 static constexpr helios::math::vec4f Honeydew{0.941f, 1.0f, 0.941f, 1.0f};
331
333 static constexpr helios::math::vec4f Seashell{1.0f, 0.961f, 0.933f, 1.0f};
334
336 static constexpr helios::math::vec4f FloralWhite{1.0f, 0.980f, 0.941f, 1.0f};
337
338 // =====================================================================
339 // Utility Methods
340 // =====================================================================
341
350 static constexpr helios::math::vec4f fromRGB(int r, int g, int b, int a = 255) {
351 return helios::math::vec4f{
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
365 static constexpr helios::math::vec4f fromHex(unsigned int hex, bool hasAlpha = false) {
366 if (hasAlpha) {
367 return helios::math::vec4f{
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 }
374 return helios::math::vec4f{
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
388 static constexpr helios::math::vec4f grayscale(float value, float alpha = 1.0f) {
389 return helios::math::vec4f{value, value, value, alpha};
390 }
391
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.9.8.