libdonut 2.3.6
Application framework for cross-platform game development in C++20
Loading...
Searching...
No Matches
Color.hpp
Go to the documentation of this file.
1#ifndef DONUT_COLOR_HPP
2#define DONUT_COLOR_HPP
3
4#include <donut/math.hpp>
5
6namespace donut {
7
11class Color {
12public:
13 static const Color INVISIBLE;
14 static const Color ALICE_BLUE;
15 static const Color ANTIQUE_WHITE;
16 static const Color AQUA;
17 static const Color AQUAMARINE;
18 static const Color AZURE;
19 static const Color BEIGE;
20 static const Color BISQUE;
21 static const Color BLACK;
22 static const Color BLANCHED_ALMOND;
23 static const Color BLUE;
24 static const Color BLUE_VIOLET;
25 static const Color BROWN;
26 static const Color BURLY_WOOD;
27 static const Color CADET_BLUE;
28 static const Color CHARTREUSE;
29 static const Color CHOCOLATE;
30 static const Color CORAL;
31 static const Color CORNFLOWER_BLUE;
32 static const Color CORNSILK;
33 static const Color CRIMSON;
34 static const Color CYAN;
35 static const Color DARK_BLUE;
36 static const Color DARK_CYAN;
37 static const Color DARK_GOLDEN_ROD;
38 static const Color DARK_GRAY;
39 static const Color DARK_GREY;
40 static const Color DARK_GREEN;
41 static const Color DARK_KHAKI;
42 static const Color DARK_MAGENTA;
43 static const Color DARK_OLIVE_GREEN;
44 static const Color DARK_ORANGE;
45 static const Color DARK_ORCHID;
46 static const Color DARK_RED;
47 static const Color DARK_SALMON;
48 static const Color DARK_SEA_GREEN;
49 static const Color DARK_SLATE_BLUE;
50 static const Color DARK_SLATE_GRAY;
51 static const Color DARK_SLATE_GREY;
52 static const Color DARK_TURQUOISE;
53 static const Color DARK_VIOLET;
54 static const Color DEEP_PINK;
55 static const Color DEEP_SKY_BLUE;
56 static const Color DIM_GRAY;
57 static const Color DIM_GREY;
58 static const Color DODGER_BLUE;
59 static const Color FIRE_BRICK;
60 static const Color FLORAL_WHITE;
61 static const Color FOREST_GREEN;
62 static const Color FUCHSIA;
63 static const Color GAINSBORO;
64 static const Color GHOST_WHITE;
65 static const Color GOLD;
66 static const Color GOLDEN_ROD;
67 static const Color GRAY;
68 static const Color GREY;
69 static const Color GREEN;
70 static const Color GREEN_YELLOW;
71 static const Color HONEY_DEW;
72 static const Color HOT_PINK;
73 static const Color INDIAN_RED;
74 static const Color INDIGO;
75 static const Color IVORY;
76 static const Color KHAKI;
77 static const Color LAVENDER;
78 static const Color LAVENDER_BLUSH;
79 static const Color LAWN_GREEN;
80 static const Color LEMON_CHIFFON;
81 static const Color LIGHT_BLUE;
82 static const Color LIGHT_CORAL;
83 static const Color LIGHT_CYAN;
85 static const Color LIGHT_GRAY;
86 static const Color LIGHT_GREY;
87 static const Color LIGHT_GREEN;
88 static const Color LIGHT_PINK;
89 static const Color LIGHT_SALMON;
90 static const Color LIGHT_SEA_GREEN;
91 static const Color LIGHT_SKY_BLUE;
92 static const Color LIGHT_SLATE_GRAY;
93 static const Color LIGHT_SLATE_GREY;
94 static const Color LIGHT_STEEL_BLUE;
95 static const Color LIGHT_YELLOW;
96 static const Color LIME;
97 static const Color LIME_GREEN;
98 static const Color LINEN;
99 static const Color MAGENTA;
100 static const Color MAROON;
102 static const Color MEDIUM_BLUE;
103 static const Color MEDIUM_ORCHID;
104 static const Color MEDIUM_PURPLE;
110 static const Color MIDNIGHT_BLUE;
111 static const Color MINT_CREAM;
112 static const Color MISTY_ROSE;
113 static const Color MOCCASIN;
114 static const Color NAVAJO_WHITE;
115 static const Color NAVY;
116 static const Color OLD_LACE;
117 static const Color OLIVE;
118 static const Color OLIVE_DRAB;
119 static const Color ORANGE;
120 static const Color ORANGE_RED;
121 static const Color ORCHID;
122 static const Color PALE_GOLDEN_ROD;
123 static const Color PALE_GREEN;
124 static const Color PALE_TURQUOISE;
125 static const Color PALE_VIOLET_RED;
126 static const Color PAPAYA_WHIP;
127 static const Color PEACH_PUFF;
128 static const Color PERU;
129 static const Color PINK;
130 static const Color PLUM;
131 static const Color POWDER_BLUE;
132 static const Color PURPLE;
133 static const Color REBECCA_PURPLE;
134 static const Color RED;
135 static const Color ROSY_BROWN;
136 static const Color ROYAL_BLUE;
137 static const Color SADDLE_BROWN;
138 static const Color SALMON;
139 static const Color SANDY_BROWN;
140 static const Color SEA_GREEN;
141 static const Color SEA_SHELL;
142 static const Color SIENNA;
143 static const Color SILVER;
144 static const Color SKY_BLUE;
145 static const Color SLATE_BLUE;
146 static const Color SLATE_GRAY;
147 static const Color SLATE_GREY;
148 static const Color SNOW;
149 static const Color SPRING_GREEN;
150 static const Color STEEL_BLUE;
151 static const Color TAN;
152 static const Color TEAL;
153 static const Color THISTLE;
154 static const Color TOMATO;
155 static const Color TURQUOISE;
156 static const Color VIOLET;
157 static const Color WHEAT;
158 static const Color WHITE;
159 static const Color WHITE_SMOKE;
160 static const Color YELLOW;
161 static const Color YELLOW_GREEN;
162
166 constexpr Color() noexcept = default;
167
177 constexpr Color(float r, float g, float b, float a = 1.0f) noexcept
178 : rgba(r, g, b, a) {}
179
189 constexpr Color(double r, double g, double b, double a = 1.0) noexcept
190 : rgba(static_cast<float>(r), static_cast<float>(g), static_cast<float>(b), static_cast<float>(a)) {}
191
202 constexpr Color(u8 r, u8 g, u8 b, u8 a = 255) noexcept
203 : Color(static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, static_cast<float>(a) / 255.0f) {}
204
215 constexpr Color(int r, int g, int b, int a = 255) noexcept
216 : Color(static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, static_cast<float>(a) / 255.0f) {}
217
227 constexpr Color(vec3 rgb) noexcept
228 : rgba(rgb.x, rgb.y, rgb.z, 1.0f) {}
229
237 constexpr Color(vec4 rgba) noexcept
238 : rgba(rgba.x, rgba.y, rgba.z, rgba.w) {}
239
250 constexpr Color(u8vec3 rgb) noexcept
251 : rgba(rgb.x, rgb.y, rgb.z, 255) {}
252
261 constexpr Color(u8vec4 rgba) noexcept
262 : rgba(rgba.x, rgba.y, rgba.z, rgba.w) {}
263
270 constexpr operator vec3() const noexcept {
271 return vec3{rgba};
272 }
273
280 constexpr operator vec4() const noexcept {
281 return rgba;
282 }
283
290 constexpr operator dvec3() const noexcept {
291 return dvec3{
292 static_cast<double>(rgba.x),
293 static_cast<double>(rgba.y),
294 static_cast<double>(rgba.z),
295 };
296 }
297
304 constexpr operator dvec4() const noexcept {
305 return dvec4{
306 static_cast<double>(rgba.x),
307 static_cast<double>(rgba.y),
308 static_cast<double>(rgba.z),
309 static_cast<double>(rgba.w),
310 };
311 }
312
320 constexpr operator u8vec3() const noexcept {
321 return u8vec3{
322 static_cast<u8>(clamp(rgba.x, 0.0f, 1.0f) * 255.0f),
323 static_cast<u8>(clamp(rgba.y, 0.0f, 1.0f) * 255.0f),
324 static_cast<u8>(clamp(rgba.z, 0.0f, 1.0f) * 255.0f),
325 };
326 }
327
335 constexpr operator u8vec4() const noexcept {
336 return u8vec4{
337 static_cast<u8>(clamp(rgba.x, 0.0f, 1.0f) * 255.0f),
338 static_cast<u8>(clamp(rgba.y, 0.0f, 1.0f) * 255.0f),
339 static_cast<u8>(clamp(rgba.z, 0.0f, 1.0f) * 255.0f),
340 static_cast<u8>(clamp(rgba.w, 0.0f, 1.0f) * 255.0f),
341 };
342 }
343
352 constexpr Color& operator+=(const Color& other) noexcept {
353 rgba += other.rgba;
354 return *this;
355 }
356
365 constexpr Color& operator-=(const Color& other) noexcept {
366 rgba -= other.rgba;
367 return *this;
368 }
369
378 constexpr Color& operator*=(const Color& other) noexcept {
379 rgba *= other.rgba;
380 return *this;
381 }
382
391 constexpr Color& operator/=(const Color& other) noexcept {
392 rgba /= other.rgba;
393 return *this;
394 }
395
403 constexpr Color& operator*=(float scalar) noexcept {
404 rgba *= scalar;
405 return *this;
406 }
407
415 constexpr Color& operator/=(float scalar) noexcept {
416 rgba /= scalar;
417 return *this;
418 }
419
427 [[nodiscard]] friend Color operator+(const Color& a) {
428 return Color{+a.rgba};
429 }
430
438 [[nodiscard]] friend Color operator-(const Color& a) {
439 return Color{-a.rgba};
440 }
441
450 [[nodiscard]] friend Color operator+(const Color& a, const Color& b) {
451 return Color{a.rgba + b.rgba};
452 }
453
462 [[nodiscard]] friend Color operator-(const Color& a, const Color& b) {
463 return Color{a.rgba - b.rgba};
464 }
465
474 [[nodiscard]] friend Color operator*(const Color& a, const Color& b) {
475 return Color{a.rgba * b.rgba};
476 }
477
486 [[nodiscard]] friend Color operator/(const Color& a, const Color& b) {
487 return Color{a.rgba / b.rgba};
488 }
489
499 [[nodiscard]] friend Color operator*(const Color& a, float b) {
500 return Color{a.rgba * b};
501 }
502
512 [[nodiscard]] friend Color operator*(float a, const Color& b) {
513 return Color{a * b.rgba};
514 }
515
525 [[nodiscard]] friend Color operator/(const Color& a, float b) {
526 return Color{a.rgba / b};
527 }
528
538 [[nodiscard]] friend Color operator/(float a, const Color& b) {
539 return Color{a / b.rgba};
540 }
541
547 constexpr void setRedComponent(float newValue) noexcept {
548 rgba.x = newValue;
549 }
550
556 constexpr void setGreenComponent(float newValue) noexcept {
557 rgba.y = newValue;
558 }
559
565 constexpr void setBlueComponent(float newValue) noexcept {
566 rgba.z = newValue;
567 }
568
574 constexpr void setAlphaComponent(float newValue) noexcept {
575 rgba.w = newValue;
576 }
577
583 [[nodiscard]] constexpr float getRedComponent() const noexcept {
584 return rgba.x;
585 }
586
592 [[nodiscard]] constexpr float getGreenComponent() const noexcept {
593 return rgba.y;
594 }
595
601 [[nodiscard]] constexpr float getBlueComponent() const noexcept {
602 return rgba.z;
603 }
604
610 [[nodiscard]] constexpr float getAlphaComponent() const noexcept {
611 return rgba.w;
612 }
613
614private:
615 vec4 rgba{0.0f, 0.0f, 0.0f, 0.0f};
616};
617
618// clang-format off
619inline constexpr Color Color::INVISIBLE { 0, 0, 0, 0};
620inline constexpr Color Color::ALICE_BLUE {240, 248, 255, 255}; // #F0F8FF
621inline constexpr Color Color::ANTIQUE_WHITE {250, 235, 215, 255}; // #FAEBD7
622inline constexpr Color Color::AQUA { 0, 255, 255, 255}; // #00FFFF
623inline constexpr Color Color::AQUAMARINE {127, 255, 212, 255}; // #7FFFD4
624inline constexpr Color Color::AZURE {240, 255, 255, 255}; // #F0FFFF
625inline constexpr Color Color::BEIGE {245, 245, 220, 255}; // #F5F5DC
626inline constexpr Color Color::BISQUE {255, 228, 196, 255}; // #FFE4C4
627inline constexpr Color Color::BLACK { 0, 0, 0, 255}; // #000000
628inline constexpr Color Color::BLANCHED_ALMOND {255, 235, 205, 255}; // #FFEBCD
629inline constexpr Color Color::BLUE { 0, 0, 255, 255}; // #0000FF
630inline constexpr Color Color::BLUE_VIOLET {138, 43, 226, 255}; // #8A2BE2
631inline constexpr Color Color::BROWN {165, 42, 42, 255}; // #A52A2A
632inline constexpr Color Color::BURLY_WOOD {222, 184, 135, 255}; // #DEB887
633inline constexpr Color Color::CADET_BLUE { 95, 158, 160, 255}; // #5F9EA0
634inline constexpr Color Color::CHARTREUSE {127, 255, 0, 255}; // #7FFF00
635inline constexpr Color Color::CHOCOLATE {210, 105, 30, 255}; // #D2691E
636inline constexpr Color Color::CORAL {255, 127, 80, 255}; // #FF7F50
637inline constexpr Color Color::CORNFLOWER_BLUE {100, 149, 237, 255}; // #6495ED
638inline constexpr Color Color::CORNSILK {255, 248, 220, 255}; // #FFF8DC
639inline constexpr Color Color::CRIMSON {220, 20, 60, 255}; // #DC143C
640inline constexpr Color Color::CYAN { 0, 255, 255, 255}; // #00FFFF
641inline constexpr Color Color::DARK_BLUE { 0, 0, 139, 255}; // #00008B
642inline constexpr Color Color::DARK_CYAN { 0, 139, 139, 255}; // #008B8B
643inline constexpr Color Color::DARK_GOLDEN_ROD {184, 134, 11, 255}; // #B8860B
644inline constexpr Color Color::DARK_GRAY {169, 169, 169, 255}; // #A9A9A9
645inline constexpr Color Color::DARK_GREY {169, 169, 169, 255}; // #A9A9A9
646inline constexpr Color Color::DARK_GREEN { 0, 100, 0, 255}; // #006400
647inline constexpr Color Color::DARK_KHAKI {189, 183, 107, 255}; // #BDB76B
648inline constexpr Color Color::DARK_MAGENTA {139, 0, 139, 255}; // #8B008B
649inline constexpr Color Color::DARK_OLIVE_GREEN { 85, 107, 47, 255}; // #556B2F
650inline constexpr Color Color::DARK_ORANGE {255, 140, 0, 255}; // #FF8C00
651inline constexpr Color Color::DARK_ORCHID {153, 50, 204, 255}; // #9932CC
652inline constexpr Color Color::DARK_RED {139, 0, 0, 255}; // #8B0000
653inline constexpr Color Color::DARK_SALMON {233, 150, 122, 255}; // #E9967A
654inline constexpr Color Color::DARK_SEA_GREEN {143, 188, 143, 255}; // #8FBC8F
655inline constexpr Color Color::DARK_SLATE_BLUE { 72, 61, 139, 255}; // #483D8B
656inline constexpr Color Color::DARK_SLATE_GRAY { 47, 79, 79, 255}; // #2F4F4F
657inline constexpr Color Color::DARK_SLATE_GREY { 47, 79, 79, 255}; // #2F4F4F
658inline constexpr Color Color::DARK_TURQUOISE { 0, 206, 209, 255}; // #00CED1
659inline constexpr Color Color::DARK_VIOLET {148, 0, 211, 255}; // #9400D3
660inline constexpr Color Color::DEEP_PINK {255, 20, 147, 255}; // #FF1493
661inline constexpr Color Color::DEEP_SKY_BLUE { 0, 191, 255, 255}; // #00BFFF
662inline constexpr Color Color::DIM_GRAY {105, 105, 105, 255}; // #696969
663inline constexpr Color Color::DIM_GREY {105, 105, 105, 255}; // #696969
664inline constexpr Color Color::DODGER_BLUE { 30, 144, 255, 255}; // #1E90FF
665inline constexpr Color Color::FIRE_BRICK {178, 34, 34, 255}; // #B22222
666inline constexpr Color Color::FLORAL_WHITE {255, 250, 240, 255}; // #FFFAF0
667inline constexpr Color Color::FOREST_GREEN { 34, 139, 34, 255}; // #228B22
668inline constexpr Color Color::FUCHSIA {255, 0, 255, 255}; // #FF00FF
669inline constexpr Color Color::GAINSBORO {220, 220, 220, 255}; // #DCDCDC
670inline constexpr Color Color::GHOST_WHITE {248, 248, 255, 255}; // #F8F8FF
671inline constexpr Color Color::GOLD {255, 215, 0, 255}; // #FFD700
672inline constexpr Color Color::GOLDEN_ROD {218, 165, 32, 255}; // #DAA520
673inline constexpr Color Color::GRAY {128, 128, 128, 255}; // #808080
674inline constexpr Color Color::GREY {128, 128, 128, 255}; // #808080
675inline constexpr Color Color::GREEN { 0, 128, 0, 255}; // #008000
676inline constexpr Color Color::GREEN_YELLOW {173, 255, 47, 255}; // #ADFF2F
677inline constexpr Color Color::HONEY_DEW {240, 255, 240, 255}; // #F0FFF0
678inline constexpr Color Color::HOT_PINK {255, 105, 180, 255}; // #FF69B4
679inline constexpr Color Color::INDIAN_RED {205, 92, 92, 255}; // #CD5C5C
680inline constexpr Color Color::INDIGO { 75, 0, 130, 255}; // #4B0082
681inline constexpr Color Color::IVORY {255, 255, 240, 255}; // #FFFFF0
682inline constexpr Color Color::KHAKI {240, 230, 140, 255}; // #F0E68C
683inline constexpr Color Color::LAVENDER {230, 230, 250, 255}; // #E6E6FA
684inline constexpr Color Color::LAVENDER_BLUSH {255, 240, 245, 255}; // #FFF0F5
685inline constexpr Color Color::LAWN_GREEN {124, 252, 0, 255}; // #7CFC00
686inline constexpr Color Color::LEMON_CHIFFON {255, 250, 205, 255}; // #FFFACD
687inline constexpr Color Color::LIGHT_BLUE {173, 216, 230, 255}; // #ADD8E6
688inline constexpr Color Color::LIGHT_CORAL {240, 128, 128, 255}; // #F08080
689inline constexpr Color Color::LIGHT_CYAN {224, 255, 255, 255}; // #E0FFFF
690inline constexpr Color Color::LIGHT_GOLDEN_ROD_YELLOW {250, 250, 210, 255}; // #FAFAD2
691inline constexpr Color Color::LIGHT_GRAY {211, 211, 211, 255}; // #D3D3D3
692inline constexpr Color Color::LIGHT_GREY {211, 211, 211, 255}; // #D3D3D3
693inline constexpr Color Color::LIGHT_GREEN {144, 238, 144, 255}; // #90EE90
694inline constexpr Color Color::LIGHT_PINK {255, 182, 193, 255}; // #FFB6C1
695inline constexpr Color Color::LIGHT_SALMON {255, 160, 122, 255}; // #FFA07A
696inline constexpr Color Color::LIGHT_SEA_GREEN { 32, 178, 170, 255}; // #20B2AA
697inline constexpr Color Color::LIGHT_SKY_BLUE {135, 206, 250, 255}; // #87CEFA
698inline constexpr Color Color::LIGHT_SLATE_GRAY {119, 136, 153, 255}; // #778899
699inline constexpr Color Color::LIGHT_SLATE_GREY {119, 136, 153, 255}; // #778899
700inline constexpr Color Color::LIGHT_STEEL_BLUE {176, 196, 222, 255}; // #B0C4DE
701inline constexpr Color Color::LIGHT_YELLOW {255, 255, 224, 255}; // #FFFFE0
702inline constexpr Color Color::LIME { 0, 255, 0, 255}; // #00FF00
703inline constexpr Color Color::LIME_GREEN { 50, 205, 50, 255}; // #32CD32
704inline constexpr Color Color::LINEN {250, 240, 230, 255}; // #FAF0E6
705inline constexpr Color Color::MAGENTA {255, 0, 255, 255}; // #FF00FF
706inline constexpr Color Color::MAROON {128, 0, 0, 255}; // #800000
707inline constexpr Color Color::MEDIUM_AQUA_MARINE {102, 205, 170, 255}; // #66CDAA
708inline constexpr Color Color::MEDIUM_BLUE { 0, 0, 205, 255}; // #0000CD
709inline constexpr Color Color::MEDIUM_ORCHID {186, 85, 211, 255}; // #BA55D3
710inline constexpr Color Color::MEDIUM_PURPLE {147, 112, 219, 255}; // #9370DB
711inline constexpr Color Color::MEDIUM_SEA_GREEN { 60, 179, 113, 255}; // #3CB371
712inline constexpr Color Color::MEDIUM_SLATE_BLUE {123, 104, 238, 255}; // #7B68EE
713inline constexpr Color Color::MEDIUM_SPRING_GREEN { 0, 250, 154, 255}; // #00FA9A
714inline constexpr Color Color::MEDIUM_TURQUOISE { 72, 209, 204, 255}; // #48D1CC
715inline constexpr Color Color::MEDIUM_VIOLET_RED {199, 21, 133, 255}; // #C71585
716inline constexpr Color Color::MIDNIGHT_BLUE { 25, 25, 112, 255}; // #191970
717inline constexpr Color Color::MINT_CREAM {245, 255, 250, 255}; // #F5FFFA
718inline constexpr Color Color::MISTY_ROSE {255, 228, 225, 255}; // #FFE4E1
719inline constexpr Color Color::MOCCASIN {255, 228, 181, 255}; // #FFE4B5
720inline constexpr Color Color::NAVAJO_WHITE {255, 222, 173, 255}; // #FFDEAD
721inline constexpr Color Color::NAVY { 0, 0, 128, 255}; // #000080
722inline constexpr Color Color::OLD_LACE {253, 245, 230, 255}; // #FDF5E6
723inline constexpr Color Color::OLIVE {128, 128, 0, 255}; // #808000
724inline constexpr Color Color::OLIVE_DRAB {107, 142, 35, 255}; // #6B8E23
725inline constexpr Color Color::ORANGE {255, 165, 0, 255}; // #FFA500
726inline constexpr Color Color::ORANGE_RED {255, 69, 0, 255}; // #FF4500
727inline constexpr Color Color::ORCHID {218, 112, 214, 255}; // #DA70D6
728inline constexpr Color Color::PALE_GOLDEN_ROD {238, 232, 170, 255}; // #EEE8AA
729inline constexpr Color Color::PALE_GREEN {152, 251, 152, 255}; // #98FB98
730inline constexpr Color Color::PALE_TURQUOISE {175, 238, 238, 255}; // #AFEEEE
731inline constexpr Color Color::PALE_VIOLET_RED {219, 112, 147, 255}; // #DB7093
732inline constexpr Color Color::PAPAYA_WHIP {255, 239, 213, 255}; // #FFEFD5
733inline constexpr Color Color::PEACH_PUFF {255, 218, 185, 255}; // #FFDAB9
734inline constexpr Color Color::PERU {205, 133, 63, 255}; // #CD853F
735inline constexpr Color Color::PINK {255, 192, 203, 255}; // #FFC0CB
736inline constexpr Color Color::PLUM {221, 160, 221, 255}; // #DDA0DD
737inline constexpr Color Color::POWDER_BLUE {176, 224, 230, 255}; // #B0E0E6
738inline constexpr Color Color::PURPLE {128, 0, 128, 255}; // #800080
739inline constexpr Color Color::REBECCA_PURPLE {102, 51, 153, 255}; // #663399
740inline constexpr Color Color::RED {255, 0, 0, 255}; // #FF0000
741inline constexpr Color Color::ROSY_BROWN {188, 143, 143, 255}; // #BC8F8F
742inline constexpr Color Color::ROYAL_BLUE { 65, 105, 225, 255}; // #4169E1
743inline constexpr Color Color::SADDLE_BROWN {139, 69, 19, 255}; // #8B4513
744inline constexpr Color Color::SALMON {250, 128, 114, 255}; // #FA8072
745inline constexpr Color Color::SANDY_BROWN {244, 164, 96, 255}; // #F4A460
746inline constexpr Color Color::SEA_GREEN { 46, 139, 87, 255}; // #2E8B57
747inline constexpr Color Color::SEA_SHELL {255, 245, 238, 255}; // #FFF5EE
748inline constexpr Color Color::SIENNA {160, 82, 45, 255}; // #A0522D
749inline constexpr Color Color::SILVER {192, 192, 192, 255}; // #C0C0C0
750inline constexpr Color Color::SKY_BLUE {135, 206, 235, 255}; // #87CEEB
751inline constexpr Color Color::SLATE_BLUE {106, 90, 205, 255}; // #6A5ACD
752inline constexpr Color Color::SLATE_GRAY {112, 128, 144, 255}; // #708090
753inline constexpr Color Color::SLATE_GREY {112, 128, 144, 255}; // #708090
754inline constexpr Color Color::SNOW {255, 250, 250, 255}; // #FFFAFA
755inline constexpr Color Color::SPRING_GREEN { 0, 255, 127, 255}; // #00FF7F
756inline constexpr Color Color::STEEL_BLUE { 70, 130, 180, 255}; // #4682B4
757inline constexpr Color Color::TAN {210, 180, 140, 255}; // #D2B48C
758inline constexpr Color Color::TEAL { 0, 128, 128, 255}; // #008080
759inline constexpr Color Color::THISTLE {216, 191, 216, 255}; // #D8BFD8
760inline constexpr Color Color::TOMATO {255, 99, 71, 255}; // #FF6347
761inline constexpr Color Color::TURQUOISE { 64, 224, 208, 255}; // #40E0D0
762inline constexpr Color Color::VIOLET {238, 130, 238, 255}; // #EE82EE
763inline constexpr Color Color::WHEAT {245, 222, 179, 255}; // #F5DEB3
764inline constexpr Color Color::WHITE {255, 255, 255, 255}; // #FFFFFF
765inline constexpr Color Color::WHITE_SMOKE {245, 245, 245, 255}; // #F5F5F5
766inline constexpr Color Color::YELLOW {255, 255, 0, 255}; // #FFFF00
767inline constexpr Color Color::YELLOW_GREEN {154, 205, 50, 255}; // #9ACD32
768// clang-format on
769
770} // namespace donut
771
772#endif
Normalized floating-point RGBA color type with 32 bits per component.
Definition Color.hpp:11
static const Color LIGHT_SALMON
Definition Color.hpp:89
static const Color PEACH_PUFF
Definition Color.hpp:127
static const Color BEIGE
Definition Color.hpp:19
static const Color HONEY_DEW
Definition Color.hpp:71
static const Color AQUAMARINE
Definition Color.hpp:17
static const Color WHEAT
Definition Color.hpp:157
constexpr Color(u8 r, u8 g, u8 b, u8 a=255) noexcept
Construct a color with given integer values for each component in the range 0-255,...
Definition Color.hpp:202
static const Color MEDIUM_VIOLET_RED
Definition Color.hpp:109
friend Color operator-(const Color &a, const Color &b)
Get the result of component-wise subtraction between two colors.
Definition Color.hpp:462
static const Color DEEP_PINK
Definition Color.hpp:54
static const Color LIGHT_PINK
Definition Color.hpp:88
static const Color GOLD
Definition Color.hpp:65
static const Color DARK_OLIVE_GREEN
Definition Color.hpp:43
static const Color SALMON
Definition Color.hpp:138
static const Color DARK_GRAY
Definition Color.hpp:38
static const Color IVORY
Definition Color.hpp:75
static const Color LIGHT_CORAL
Definition Color.hpp:82
static const Color STEEL_BLUE
Definition Color.hpp:150
static const Color BLUE_VIOLET
Definition Color.hpp:24
static const Color DARK_ORCHID
Definition Color.hpp:45
static const Color LINEN
Definition Color.hpp:98
static const Color MEDIUM_TURQUOISE
Definition Color.hpp:108
constexpr Color & operator-=(const Color &other) noexcept
Subtract the component values of another color from the respective component values of this color.
Definition Color.hpp:365
constexpr Color(vec3 rgb) noexcept
Construct a color from a vector with 3 components, XYZ, that map to the color components RGB,...
Definition Color.hpp:227
static const Color MEDIUM_AQUA_MARINE
Definition Color.hpp:101
static const Color DODGER_BLUE
Definition Color.hpp:58
constexpr Color & operator/=(const Color &other) noexcept
Divide the component values of this color with the respective component values of another color.
Definition Color.hpp:391
static const Color RED
Definition Color.hpp:134
static const Color AQUA
Definition Color.hpp:16
static const Color THISTLE
Definition Color.hpp:153
static const Color FIRE_BRICK
Definition Color.hpp:59
constexpr Color & operator*=(float scalar) noexcept
Multiply each of the component values of this color by a scalar value.
Definition Color.hpp:403
constexpr Color() noexcept=default
Construct a transparent color with a value of 0 in all components.
static const Color GOLDEN_ROD
Definition Color.hpp:66
static const Color CADET_BLUE
Definition Color.hpp:27
static const Color SEA_SHELL
Definition Color.hpp:141
static const Color DARK_ORANGE
Definition Color.hpp:44
static const Color ROSY_BROWN
Definition Color.hpp:135
static const Color LIGHT_GOLDEN_ROD_YELLOW
Definition Color.hpp:84
friend Color operator*(const Color &a, float b)
Get the result of multiplication between a color and a scalar.
Definition Color.hpp:499
static const Color PLUM
Definition Color.hpp:130
static const Color SANDY_BROWN
Definition Color.hpp:139
constexpr void setAlphaComponent(float newValue) noexcept
Set the value of the alpha component of this color.
Definition Color.hpp:574
static const Color WHITE_SMOKE
Definition Color.hpp:159
static const Color ORANGE_RED
Definition Color.hpp:120
static const Color PALE_VIOLET_RED
Definition Color.hpp:125
static const Color NAVAJO_WHITE
Definition Color.hpp:114
static const Color MEDIUM_SLATE_BLUE
Definition Color.hpp:106
friend Color operator*(float a, const Color &b)
Get the result of multiplication between a scalar and a color.
Definition Color.hpp:512
static const Color SLATE_GRAY
Definition Color.hpp:146
static const Color NAVY
Definition Color.hpp:115
static const Color LIGHT_SEA_GREEN
Definition Color.hpp:90
constexpr float getGreenComponent() const noexcept
Get the value of the green component of this color.
Definition Color.hpp:592
static const Color LIGHT_GREEN
Definition Color.hpp:87
static const Color GHOST_WHITE
Definition Color.hpp:64
constexpr Color(u8vec4 rgba) noexcept
Construct a color from a vector with 4 integer components in the range 0-255, XYZW,...
Definition Color.hpp:261
static const Color SIENNA
Definition Color.hpp:142
static const Color DARK_MAGENTA
Definition Color.hpp:42
static const Color INDIAN_RED
Definition Color.hpp:73
static const Color INVISIBLE
Definition Color.hpp:13
static const Color DARK_VIOLET
Definition Color.hpp:53
static const Color GAINSBORO
Definition Color.hpp:63
static const Color LAVENDER_BLUSH
Definition Color.hpp:78
static const Color BISQUE
Definition Color.hpp:20
constexpr float getBlueComponent() const noexcept
Get the value of the blue component of this color.
Definition Color.hpp:601
constexpr void setGreenComponent(float newValue) noexcept
Set the value of the green component of this color.
Definition Color.hpp:556
static const Color DIM_GREY
Definition Color.hpp:57
static const Color LIGHT_SKY_BLUE
Definition Color.hpp:91
static const Color SADDLE_BROWN
Definition Color.hpp:137
static const Color SILVER
Definition Color.hpp:143
static const Color LAWN_GREEN
Definition Color.hpp:79
static const Color PURPLE
Definition Color.hpp:132
static const Color PAPAYA_WHIP
Definition Color.hpp:126
static const Color BURLY_WOOD
Definition Color.hpp:26
static const Color ALICE_BLUE
Definition Color.hpp:14
static const Color DARK_GREEN
Definition Color.hpp:40
friend Color operator+(const Color &a)
Get the component-wise additive identity of a color.
Definition Color.hpp:427
static const Color LAVENDER
Definition Color.hpp:77
static const Color MEDIUM_SEA_GREEN
Definition Color.hpp:105
friend Color operator*(const Color &a, const Color &b)
Get the result of component-wise multiplication between two colors.
Definition Color.hpp:474
static const Color SKY_BLUE
Definition Color.hpp:144
constexpr float getRedComponent() const noexcept
Get the value of the red component of this color.
Definition Color.hpp:583
static const Color LIME
Definition Color.hpp:96
static const Color DIM_GRAY
Definition Color.hpp:56
static const Color POWDER_BLUE
Definition Color.hpp:131
static const Color TAN
Definition Color.hpp:151
constexpr Color & operator+=(const Color &other) noexcept
Add the component values of another color to the respective component values of this color.
Definition Color.hpp:352
static const Color LIGHT_SLATE_GREY
Definition Color.hpp:93
static const Color OLIVE_DRAB
Definition Color.hpp:118
static const Color MEDIUM_PURPLE
Definition Color.hpp:104
static const Color DARK_SALMON
Definition Color.hpp:47
static const Color PERU
Definition Color.hpp:128
static const Color ANTIQUE_WHITE
Definition Color.hpp:15
static const Color YELLOW
Definition Color.hpp:160
static const Color DARK_RED
Definition Color.hpp:46
static const Color DARK_SEA_GREEN
Definition Color.hpp:48
static const Color PALE_TURQUOISE
Definition Color.hpp:124
static const Color LIGHT_SLATE_GRAY
Definition Color.hpp:92
static const Color CYAN
Definition Color.hpp:34
static const Color ORANGE
Definition Color.hpp:119
static const Color DARK_TURQUOISE
Definition Color.hpp:52
static const Color DARK_BLUE
Definition Color.hpp:35
static const Color MEDIUM_SPRING_GREEN
Definition Color.hpp:107
static const Color LIGHT_STEEL_BLUE
Definition Color.hpp:94
static const Color DARK_KHAKI
Definition Color.hpp:41
static const Color GREY
Definition Color.hpp:68
static const Color DARK_GREY
Definition Color.hpp:39
static const Color DARK_CYAN
Definition Color.hpp:36
static const Color OLD_LACE
Definition Color.hpp:116
static const Color AZURE
Definition Color.hpp:18
static const Color MEDIUM_ORCHID
Definition Color.hpp:103
static const Color LIGHT_GREY
Definition Color.hpp:86
static const Color CRIMSON
Definition Color.hpp:33
static const Color SEA_GREEN
Definition Color.hpp:140
static const Color PALE_GOLDEN_ROD
Definition Color.hpp:122
static const Color DARK_SLATE_GRAY
Definition Color.hpp:50
constexpr Color(u8vec3 rgb) noexcept
Construct a color from a vector with 3 integer components in the range 0-255, XYZ,...
Definition Color.hpp:250
static const Color GRAY
Definition Color.hpp:67
static const Color CHOCOLATE
Definition Color.hpp:29
static const Color CORNFLOWER_BLUE
Definition Color.hpp:31
static const Color INDIGO
Definition Color.hpp:74
constexpr Color & operator/=(float scalar) noexcept
Divide each of the component values of this color by a scalar value.
Definition Color.hpp:415
static const Color FUCHSIA
Definition Color.hpp:62
static const Color FLORAL_WHITE
Definition Color.hpp:60
static const Color LIME_GREEN
Definition Color.hpp:97
static const Color MEDIUM_BLUE
Definition Color.hpp:102
constexpr Color(vec4 rgba) noexcept
Construct a color from a vector with 4 components, XYZW, that map to the color components RGBA,...
Definition Color.hpp:237
static const Color HOT_PINK
Definition Color.hpp:72
static const Color GREEN_YELLOW
Definition Color.hpp:70
static const Color MISTY_ROSE
Definition Color.hpp:112
static const Color VIOLET
Definition Color.hpp:156
static const Color ORCHID
Definition Color.hpp:121
static const Color MINT_CREAM
Definition Color.hpp:111
static const Color BROWN
Definition Color.hpp:25
static const Color DEEP_SKY_BLUE
Definition Color.hpp:55
static const Color LIGHT_YELLOW
Definition Color.hpp:95
constexpr Color(double r, double g, double b, double a=1.0) noexcept
Construct a color with given values for each component.
Definition Color.hpp:189
constexpr Color & operator*=(const Color &other) noexcept
Multiply the component values of this color with the respective component values of another color.
Definition Color.hpp:378
static const Color LIGHT_BLUE
Definition Color.hpp:81
static const Color CORNSILK
Definition Color.hpp:32
static const Color YELLOW_GREEN
Definition Color.hpp:161
static const Color REBECCA_PURPLE
Definition Color.hpp:133
static const Color SNOW
Definition Color.hpp:148
constexpr void setRedComponent(float newValue) noexcept
Set the value of the red component of this color.
Definition Color.hpp:547
static const Color BLUE
Definition Color.hpp:23
friend Color operator/(const Color &a, float b)
Get the result of division between a color and a scalar.
Definition Color.hpp:525
static const Color LEMON_CHIFFON
Definition Color.hpp:80
static const Color GREEN
Definition Color.hpp:69
static const Color SPRING_GREEN
Definition Color.hpp:149
constexpr Color(int r, int g, int b, int a=255) noexcept
Construct a color with given integer values for each component in the range 0-255,...
Definition Color.hpp:215
static const Color PINK
Definition Color.hpp:129
constexpr void setBlueComponent(float newValue) noexcept
Set the value of the blue component of this color.
Definition Color.hpp:565
static const Color BLANCHED_ALMOND
Definition Color.hpp:22
static const Color MOCCASIN
Definition Color.hpp:113
static const Color TURQUOISE
Definition Color.hpp:155
static const Color DARK_SLATE_GREY
Definition Color.hpp:51
static const Color FOREST_GREEN
Definition Color.hpp:61
static const Color CORAL
Definition Color.hpp:30
friend Color operator/(float a, const Color &b)
Get the result of division between a scalar and a color.
Definition Color.hpp:538
static const Color WHITE
Definition Color.hpp:158
static const Color OLIVE
Definition Color.hpp:117
static const Color MIDNIGHT_BLUE
Definition Color.hpp:110
static const Color CHARTREUSE
Definition Color.hpp:28
static const Color SLATE_BLUE
Definition Color.hpp:145
static const Color DARK_GOLDEN_ROD
Definition Color.hpp:37
static const Color LIGHT_GRAY
Definition Color.hpp:85
static const Color SLATE_GREY
Definition Color.hpp:147
friend Color operator+(const Color &a, const Color &b)
Get the result of component-wise addition between two colors.
Definition Color.hpp:450
static const Color TEAL
Definition Color.hpp:152
static const Color ROYAL_BLUE
Definition Color.hpp:136
constexpr float getAlphaComponent() const noexcept
Get the value of the alpha component of this color.
Definition Color.hpp:610
static const Color LIGHT_CYAN
Definition Color.hpp:83
friend Color operator/(const Color &a, const Color &b)
Get the result of component-wise division between two colors.
Definition Color.hpp:486
static const Color MAGENTA
Definition Color.hpp:99
static const Color PALE_GREEN
Definition Color.hpp:123
static const Color KHAKI
Definition Color.hpp:76
friend Color operator-(const Color &a)
Get the component-wise additive inverse of a color.
Definition Color.hpp:438
static const Color BLACK
Definition Color.hpp:21
static const Color TOMATO
Definition Color.hpp:154
static const Color DARK_SLATE_BLUE
Definition Color.hpp:49
static const Color MAROON
Definition Color.hpp:100
Definition Application.hpp:9