qualpal 3.3.0
Loading...
Searching...
No Matches
qualpal::colors::HSL Class Reference

HSL (Hue, Saturation, Lightness) color representation. More...

#include <colors.h>

Public Member Functions

 HSL ()
 Default constructor initializes HSL to black (0,0,0)
 
 HSL (const double h, const double s, const double l)
 Construct HSL from component values.
 
 HSL (const RGB &rgb)
 Construct HSL from RGB color.
 
 HSL (const XYZ &xyz)
 Construct HSL from XYZ color.
 
 HSL (const Lab &lab)
 Construct HSL from Lab color.
 
 HSL (const LCHab &lch)
 Construct HSL from LCHab color.
 
bool operator== (const HSL &other) const
 Equality operator for HSL colors.
 
bool operator!= (const HSL &other) const
 Inequality operator for HSL colors.
 
double h () const
 Get hue in degrees [0,360)
 
double s () const
 Get saturation [0,1].
 
double l () const
 Get lightness [0,1].
 

Detailed Description

HSL (Hue, Saturation, Lightness) color representation.

Represents a color in the HSL color space:

  • Hue: [0, 360) degrees (0 = red, 120 = green, 240 = blue)
  • Saturation: [0, 1] (0 = gray, 1 = fully saturated)
  • Lightness: [0, 1] (0 = black, 1 = white)

Provides conversion constructors for RGB, XYZ, Lab, and LCHab color spaces.

HSL orange(30, 1.0, 0.5); // Pure orange
HSL gray(0, 0.0, 0.5); // Medium gray
HSL from_rgb(RGB(0.5, 0.2, 0.7));
HSL (Hue, Saturation, Lightness) color representation.
Definition colors.h:218
RGB color representation with values in [0,1] range.
Definition colors.h:92
See also
RGB, XYZ, Lab, LCHab for conversions.

Definition at line 217 of file colors.h.

Constructor & Destructor Documentation

◆ HSL() [1/5]

qualpal::colors::HSL::HSL ( const double  h,
const double  s,
const double  l 
)

Construct HSL from component values.

Parameters
hHue in degrees [0,360)
sSaturation [0,1]
lLightness [0,1]

◆ HSL() [2/5]

qualpal::colors::HSL::HSL ( const RGB rgb)

Construct HSL from RGB color.

Parameters
rgbRGB color to convert from

◆ HSL() [3/5]

qualpal::colors::HSL::HSL ( const XYZ xyz)

Construct HSL from XYZ color.

Parameters
xyzXYZ color to convert from

◆ HSL() [4/5]

qualpal::colors::HSL::HSL ( const Lab lab)

Construct HSL from Lab color.

Parameters
labLab color to convert from

◆ HSL() [5/5]

qualpal::colors::HSL::HSL ( const LCHab lch)

Construct HSL from LCHab color.

Parameters
lchLCHab color to convert from

Member Function Documentation

◆ h()

double qualpal::colors::HSL::h ( ) const
inline

Get hue in degrees [0,360)

Definition at line 281 of file colors.h.

◆ l()

double qualpal::colors::HSL::l ( ) const
inline

Get lightness [0,1].

Definition at line 285 of file colors.h.

◆ operator!=()

bool qualpal::colors::HSL::operator!= ( const HSL other) const
inline

Inequality operator for HSL colors.

Parameters
otherOther HSL color to compare with
Returns
true if HSL colors are not equal, false otherwise

Definition at line 278 of file colors.h.

◆ operator==()

bool qualpal::colors::HSL::operator== ( const HSL other) const
inline

Equality operator for HSL colors.

Parameters
otherOther HSL color to compare with
Returns
true if both HSL colors are equal, false otherwise

Definition at line 267 of file colors.h.

◆ s()

double qualpal::colors::HSL::s ( ) const
inline

Get saturation [0,1].

Definition at line 283 of file colors.h.


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