qualpal 2.3.0
Loading...
Searching...
No Matches
qualpal::colors Namespace Reference

Color representation classes for various color spaces. More...

Classes

class  DIN99d
 DIN99d color space representation. More...
 
class  HSL
 HSL (Hue, Saturation, Lightness) color representation. More...
 
class  Lab
 Lab color space representation (CIE L*a*b*) More...
 
class  LCHab
 LCHab color space representation (CIE L*C*h) More...
 
class  RGB
 RGB color representation with values in [0,1] range. More...
 
class  XYZ
 XYZ color representation (CIE 1931 color space) More...
 

Detailed Description

Color representation classes for various color spaces.

This namespace provides classes for representing colors in different color spaces commonly used in color science and palette generation. All classes support seamless conversion between color spaces through constructor overloads.

Supported Color Spaces:

  • RGB: Standard red-green-blue with values normalized to [0,1]
  • HSL: Hue-saturation-lightness for intuitive color manipulation
  • XYZ: CIE 1931 device-independent intermediate color space
  • Lab: CIE L*a*b* perceptually uniform color space
  • DIN99d: Optimized perceptually uniform space for color differences

Usage Pattern:

// Create colors in any space
RGB red(1.0, 0.0, 0.0);
HSL orange(30, 1.0, 0.5);
// Convert between spaces automatically
RGB red_from_hsl(orange); // Constructor conversion
Lab red_lab(red); // Chain conversions
// Use with palette algorithms
std::vector<DIN99d> palette_colors;
auto indices = farthestPoints(5, palette_colors);
HSL (Hue, Saturation, Lightness) color representation.
Definition colors.h:195
Lab color space representation (CIE L*a*b*)
Definition colors.h:439
RGB color representation with values in [0,1] range.
Definition colors.h:84

All color classes provide:

  • Conversion constructors from other color spaces
  • Accessor methods for individual components
  • Consistent naming (r(), g(), b() for RGB; h(), s(), l() for HSL, etc.)
See also
metrics namespace for color difference calculations
farthestPoints() for palette selection algorithms