12 using Channel = std::uint8_t;
13 Channel red = 0, green = 0, blue = 0, alpha = 0;
17 Color(std::uint32_t argb)
25 Color(Channel red, Channel green, Channel blue)
33 Color withAlpha(Channel newAlpha)
const
36 result.alpha = newAlpha;
40 static Color fromHSV(
double h,
double s,
double v);
44 void setHue(
double h);
46 double saturation()
const;
48 void setSaturation(
double s);
52 void setValue(
double v);
54 std::uint32_t argb()
const {
return alpha << 24 | red << 16 | green << 8 | blue; }
55 std::uint32_t bgr()
const {
return blue << 16 | green << 8 | red; }
56 std::uint32_t abgr()
const {
return alpha << 24 | blue << 16 | green << 8 | red; }
58 std::uint32_t gl()
const {
return *
reinterpret_cast<const std::uint32_t*
>(
this); }
60 static const Color NONE;
61 static const Color BLACK;
62 static const Color GRAY;
63 static const Color WHITE;
65 static const Color AQUA;
66 static const Color CYAN;
68 static const Color RED;
69 static const Color GREEN;
70 static const Color BLUE;
71 static const Color YELLOW;
72 static const Color FUCHSIA;
74 std::strong_ordering operator<=>(
const Color&)
const =
default;