33 float r = 0.f,
g = 0.f,
b = 0.f;
45 constexpr
Color(
float red,
float green,
float blue,
float alpha = 1.f)
62 constexpr
static Color rgba8(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) {
63 return Color(red / 255.f, green / 255.f, blue / 255.f, alpha / 255.f);
71 constexpr
static Color rgb8(uint8_t red, uint8_t green, uint8_t blue) {
72 return rgba8(red, green, blue, 255);
79 const auto a = ((argb >> 24) & 0xFF) / 255.f;
80 const auto r = ((argb >> 16) & 0xFF) / 255.f;
81 const auto g = ((argb >> 8) & 0xFF) / 255.f;
82 const auto b = (argb & 0xFF) / 255.f;
94 const auto a = ((abgr >> 24) & 0xFF) / 255.f;
95 const auto b = ((abgr >> 16) & 0xFF) / 255.f;
96 const auto g = ((abgr >> 8) & 0xFF) / 255.f;
97 const auto r = (abgr & 0xFF) / 255.f;
108 const auto alpha =
static_cast<uint8_t
>(
a * 255);
109 const auto red =
static_cast<uint8_t
>(
r * 255);
110 const auto green =
static_cast<uint8_t
>(
g * 255);
111 const auto blue =
static_cast<uint8_t
>(
b * 255);
112 uint32_t color = (alpha << 24) | (blue << 16) | (green << 8) | (red);
122 const auto r = color1.
r * (1 - lamda) + color2.
r * lamda;
123 const auto g = color1.
g * (1 - lamda) + color2.
g * lamda;
124 const auto b = color1.
b * (1 - lamda) + color2.
b * lamda;
129 const uint32_t colors[] = {
130 0xFF000000, 0xFF00FF00, 0xFF0000FF, 0xFFFF0000, 0xFF01FFFE, 0xFFFFA6FE,
131 0xFFFFDB66, 0xFF006401, 0xFF010067, 0xFF95003A, 0xFF007DB5, 0xFFFF00F6,
132 0xFFFFEEE8, 0xFF774D00, 0xFF90FB92, 0xFF0076FF, 0xFFD5FF00, 0xFFFF937E,
133 0xFF6A826C, 0xFFFF029D, 0xFFFE8900, 0xFF7A4782, 0xFF7E2DD2, 0xFF85A900,
134 0xFFFF0056, 0xFFA42400, 0xFF00AE7E, 0xFF683D3B, 0xFFBDC6FF, 0xFF263400,
135 0xFFBDD393, 0xFF00B917, 0xFF9E008E, 0xFF001544, 0xFFC28C9F, 0xFFFF74A3,
136 0xFF01D0FF, 0xFF004754, 0xFFE56FFE, 0xFF788231, 0xFF0E4CA1, 0xFF91D0CB,
137 0xFFBE9970, 0xFF968AE8, 0xFFBB8800, 0xFF43002C, 0xFFDEFF74, 0xFF00FFC6,
138 0xFFFFE502, 0xFF620E00, 0xFF008F9C, 0xFF98FF52, 0xFF7544B1, 0xFFB500FF,
139 0xFF00FF78, 0xFFFF6E41, 0xFF005F39, 0xFF6B6882, 0xFF5FAD4E, 0xFFA75740,
140 0xFFA5FFD2, 0xFFFFB167, 0xFF009BFF, 0xFFE85EBE
Primitive color type used through the engine.
constexpr static Color rgb8(uint8_t red, uint8_t green, uint8_t blue)
Create a color from RGB components.
constexpr uint32_t get_value() const
Get the raw value of the color.
constexpr Color(float red, float green, float blue, float alpha=1.f)
constexpr static Color get_random(size_t mod)
constexpr static Color bgr32(uint32_t abgr)
constexpr static Color abgr32(uint32_t abgr)
constexpr static Color rgba8(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
Create a color from RGBA components.
constexpr static Color argb32(uint32_t argb)
Create a color from RGBA32 components.
constexpr static Color rgb32(uint32_t argb)
Create a color from RGB32 components.
constexpr static Color lerp(Color color1, Color color2, float lamda)
Combine two colors with LERP.