37 std::uint8_t alpha{0xFF};
42 constexpr explicit operator std::uint32_t() const noexcept {
43 return (
static_cast<std::uint32_t
>(alpha) << 24) + (
static_cast<std::uint32_t
>(b) << 16)
44 + (
static_cast<std::uint32_t
>(g) << 8) + r;
55 requires std::is_arithmetic_v<T>
56 constexpr auto normalize(T min, T max)
const noexcept {
57 constexpr auto source_range =
58 std::numeric_limits<std::uint8_t>::max() - std::numeric_limits<std::uint8_t>::min();
59 auto convert = [&](std::uint8_t value) {
return value * (max - min) /
static_cast<T
>(source_range) + min; };
61 struct normalized_color {
66 } result{convert(r), convert(g), convert(b), convert(alpha)};
77 constexpr argb_color make_argb_color(std::uint32_t color)
noexcept {
79 .r =
static_cast<std::uint8_t
>(color),
80 .g =
static_cast<std::uint8_t
>(color >> 8),
81 .b =
static_cast<std::uint8_t
>(color >> 16),
82 .alpha =
static_cast<std::uint8_t
>(color >> 24),
229 static constexpr argb_color medium_aquamarine{
289 static constexpr argb_color medium_slate_blue{
301 static constexpr argb_color medium_spring_green{
325 static constexpr argb_color medium_violet_red{
883 static constexpr argb_color light_goldenrod_yellow{
Describes a ARGB color.
Definition argb_color.hpp:33
constexpr auto normalize(T min, T max) const noexcept
Normalizes the data to a new range.
Definition argb_color.hpp:56
Common predefined colors.
Definition argb_color.hpp:90