Types
OkLchColor
Represents an OKLCH color.Lightness component (0-1)
Chroma component (colorfulness)
Hue in degrees (0-360)
The alpha channel value (0-1). Optional.
rgbToOkLch
Converts an RGB color to an OKLCH color.The RGB color to convert
The OKLCH color
Example
okLchToRgb
Converts an OKLCH color to an RGB color.The OKLCH color to convert
The RGB color
Example
okLabToOkLch
Converts an OKLab color to an OKLCH color.The OKLab color to convert
The OKLCH color
Example
okLchToOkLab
Converts an OKLCH color to an OKLab color.The OKLCH color to convert
The OKLab color
Example
About OKLCH color space
OKLCH is a perceptually uniform color space based on OKLab, using cylindrical coordinates. It offers several advantages:- Perceptual uniformity: Equal changes in values correspond to equal perceptual changes
- Intuitive hue: The hue component works like HSL but is perceptually accurate
- Wide gamut support: Can represent colors beyond sRGB
- Modern standard: Gaining adoption in CSS and design tools
- L: Lightness from 0 (black) to 1 (white)
- C: Chroma (colorfulness), typically 0 to 0.4
- H: Hue in degrees (0-360)