aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
aest::colors::CIELab Class Referencefinalexport

A color in CIELab, the CIE 1976 L*a*b* space, relative to D50. More...

Inheritance diagram for aest::colors::CIELab:
aest::colors::ColorBase< CIELab >

Public Member Functions

constexpr CIELab ()
 Default constructor initializes the color to opaque black (0, 0, 0, 1).
constexpr CIELab (const float l, const float a, const float b, const float alpha=1.0f)
 Construct a color from CIELab values and alpha.
Color Channels
constexpr float lightness () const noexcept
 Get the lightness, 100 being D50 white.
constexpr float a () const noexcept
 Get the green-red axis, negative toward green.
constexpr float b () const noexcept
 Get the blue-yellow axis, negative toward blue.
Public Member Functions inherited from aest::colors::ColorBase< CIELab >
constexpr float alpha () const noexcept
 Get the alpha channel value in the 0-1 range.
constexpr float ch1 () const noexcept
 Get the first channel value.
constexpr float ch2 () const noexcept
 Get the second channel value.
constexpr float ch3 () const noexcept
 Get the third channel value.
constexpr CIELab opacity (const float alpha) const
 Returns a new color with the same channels and the specified alpha value.

Static Public Attributes

static constexpr std::string_view TYPE = "CIELab"
 Color space name, used by the std::formatter specialization.

Additional Inherited Members

Public Attributes inherited from aest::colors::ColorBase< CIELab >
friend Derived
 Lets the derived color reach the private constructor and channels.

Detailed Description

A color in CIELab, the CIE 1976 L*a*b* space, relative to D50.

L is the lightness, 0 for black and 100 for the D50 white; a runs from green to red and b from blue to yellow, both 0 for grays. The white point and its Bradford adaptation from D65 are the ones of CSS Color 4, so the values match CSS lab(). CIELab is the space of the CIE color difference formulas, de_76(), de_94() and de_2000(); OKLab is more even across hues for gradients and adjustments. Channels are not clamped: HDR colors have L above 100.

See also
ISO/CIE 11664-4, CSS Color 4

Definition at line 71 of file CieLab.cppm.

Constructor & Destructor Documentation

◆ CIELab() [1/2]

aest::colors::CIELab::CIELab ( )
inlineconstexpr

Default constructor initializes the color to opaque black (0, 0, 0, 1).

Definition at line 78 of file CieLab.cppm.

◆ CIELab() [2/2]

aest::colors::CIELab::CIELab ( const float l,
const float a,
const float b,
const float alpha = 1.0f )
inlineconstexpr

Construct a color from CIELab values and alpha.

Parameters
[in]lLightness, 100 being D50 white
[in]aGreen-red axis
[in]bBlue-yellow axis
[in]alphaAlpha channel value (default 1.0)
Precondition
Every channel is finite: NaN and infinities are undefined behavior.

Definition at line 90 of file CieLab.cppm.

Member Function Documentation

◆ a()

float aest::colors::CIELab::a ( ) const
inlinenodiscardconstexprnoexcept

Get the green-red axis, negative toward green.

Returns
The a* channel

Definition at line 106 of file CieLab.cppm.

◆ b()

float aest::colors::CIELab::b ( ) const
inlinenodiscardconstexprnoexcept

Get the blue-yellow axis, negative toward blue.

Returns
The b* channel

Definition at line 112 of file CieLab.cppm.

◆ lightness()

float aest::colors::CIELab::lightness ( ) const
inlinenodiscardconstexprnoexcept

Get the lightness, 100 being D50 white.

Returns
The L* channel

Definition at line 100 of file CieLab.cppm.

Member Data Documentation

◆ TYPE

std::string_view aest::colors::CIELab::TYPE = "CIELab"
staticconstexpr

Color space name, used by the std::formatter specialization.

Definition at line 75 of file CieLab.cppm.


The documentation for this class was generated from the following file: