Qualpal
Repositories

qualpal::colors::LCHab

C++ · cpp · 4.1.0

class qualpal::colors::LCHab

LCHab color space representation (CIE L*C*h).

LCHab color space representation (CIE L*C*h).

Cylindrical representation of Lab color space:

  • L: Lightness [0, 100]

  • C: Chroma [0, ∞)

  • H: Hue in degrees [0, 360)

Useful for intuitive manipulation of color lightness, chroma, and hue. Provides conversion constructors for Lab, RGB, HSL, and XYZ. Most conversions use the D65 reference white point by default.

See also

Lab, RGB, HSL, XYZ for conversions.

Methods

LCHab

LCHab

LCHab()

Default constructor initializes LCHab to black (0,0,0).

LCHab

LCHab(const HSL & hsl)

Construct LCHab from HSL color.

Parameters

hsl

HSL color to convert from

LCHab

LCHab(const Lab & lab)

Construct LCHab from Lab color.

Parameters

lab

Lab color to convert from

LCHab

LCHab(const RGB & rgb)

Construct LCHab from RGB color.

Parameters

rgb

RGB color to convert from

LCHab

LCHab(const XYZ & xyz, const std::array<double, 3> & white_point = { 0.95047, 1, 1.08883 })

Construct LCHab from XYZ color.

Parameters

xyz

XYZ color to convert from

white_point

Reference white point (default: D65)

LCHab

LCHab(const double l, const double c, const double h)

Construct LCHab from component values.

Parameters

l

Lightness [0,100]

c

Chroma [0,∞)

h

Hue in degrees [0,360)

c

inline double c() const

Get chroma [0,∞).

h

inline double h() const

Get hue in degrees [0,360).

l

inline double l() const

Get lightness [0,100].

operator!=

inline bool operator!=(const LCHab & other) const

inequality operator for LCHab colors

Parameters

other

Other LCHab color to compare with

Returns

true if LCHab colors are not equal, false otherwise

operator==

inline bool operator==(const LCHab & other) const

equality operator for LCHab colors

Parameters

other

Other LCHab color to compare with

Returns

true if both LCHab colors are equal, false otherwise