qualpal::colors
C++ · cpp · 4.1.0
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 ;
HSL ;
// Convert between spaces automatically
RGB ; // Constructor conversion
Lab ; // Chain conversions
// Use with palette algorithms
std::vector<DIN99d> palette_colors;
auto indices = ;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
See also
farthestPoints() for palette selection algorithms
