16export namespace aest::colors
31template <BoundedRGBSpace RGB>
35 static constexpr std::string_view
MODEL =
"HSL";
43 static constexpr std::string_view
TYPE =
44 std::same_as<RGB, SRGB> ?
MODEL
60 constexpr BasicHSL(
const float h,
const float s,
const float l,
const float a = 1.0f)
70 [[nodiscard]]
constexpr float hue() const noexcept {
return this->
_ch1; }
76 [[nodiscard]]
constexpr float saturation() const noexcept {
return this->
_ch2; }
82 [[nodiscard]]
constexpr float lightness() const noexcept {
return this->
_ch3; }
98template <BoundedRGBSpace RGB>
102 static constexpr std::string_view
MODEL =
"HSV";
110 static constexpr std::string_view
TYPE =
111 std::same_as<RGB, SRGB> ?
MODEL
127 constexpr BasicHSV(
const float h,
const float s,
const float v,
const float a = 1.0f)
137 [[nodiscard]]
constexpr float hue() const noexcept {
return this->
_ch1; }
constexpr float clamp(const float value)
Clamp a floating-point value to the 0-1 range.
constexpr std::array< char, Size > join_names(const std::initializer_list< std::string_view > parts)
Concatenate names into a character array, for a color space name built at compile time.
constexpr float wrap_hue(const float hue)
Wrap a hue angle to the [0, 360) range.
BasicHSL< SRGB > HSL
HSL over sRGB, the HSL of CSS.
BasicHSV< SRGB > HSV
HSV over sRGB.
A color as hue, saturation and lightness, over the encoded RGB space RGB.
static constexpr auto QUALIFIED_CHARS
static constexpr std::string_view TYPE
constexpr BasicHSL()
Default constructor initializes the color to opaque black (0, 0, 0, 1).
static constexpr std::string_view MODEL
constexpr BasicHSL(const float h, const float s, const float l, const float a=1.0f)
Construct a color from floating-point HSLA values.
constexpr float lightness() const noexcept
Get the lightness value in the 0-1 range.
constexpr float saturation() const noexcept
Get the saturation value in the 0-1 range.
constexpr float hue() const noexcept
Get the hue value in the 0-360 range.
A color as hue, saturation and value (brightness), over the encoded RGB space RGB.
constexpr float brightness() const noexcept
Get the brightness value in the 0-1 range.
constexpr BasicHSV()
Default constructor initializes the color to opaque black (0, 0, 0, 1).
constexpr BasicHSV(const float h, const float s, const float v, const float a=1.0f)
Construct a color from floating-point HSVA values.
static constexpr std::string_view MODEL
constexpr float saturation() const noexcept
Get the saturation value in the 0-1 range.
constexpr float hue() const noexcept
Get the hue value in the 0-360 range.
static constexpr std::string_view TYPE
static constexpr auto QUALIFIED_CHARS
constexpr ColorBase(const float alpha, const float channel1, const float channel2, const float channel3)