IOKLCH

Type interface

OKLCH color helpers.

OKLCH is a perceptually-uniform cylindrical color space (lightness, chroma, hue) derived from Björn Ottosson's OKLab. Unlike HSL, equal steps in OKLCH lightness/hue look equally different to the eye, which makes it ideal for generating balanced categorical palettes from a single seed color.

This module is a small, dependency-free converter (sRGB <> OKLab <> OKLCH) plus an sRGB gamut clamp. It is additive: nothing in the existing color pipeline changes. Themes that need perceptual palettes import it to pre-compute a colors array.

Ranges:

- l (lightness): 0 (black) .. 1 (white) - c (chroma): 0 (gray) .. ~0.37 (most saturated sRGB) - h (hue): 0 .. 360 degrees

Click here for the source math

Inheritance

IOKLCH does not extend any other symbol.

IOKLCH is not extended by any other symbol.

Properties

c
#

Type number

Chroma, 0 .. ~0.37

h
#

Type number

Hue, 0 .. 360 degrees

l
#

Type number

Lightness, 0 .. 1