Module color.oklch
OKLCH values, degree-based hue handling, and component replacement.
Use OKLCH when perceptual lightness, chroma, and hue are more convenient than
Oklab's Cartesian axes. Hue storage is deliberately raw and unbounded.
Normalization, canonicalization, component replacement, and conversion remain
explicit operations.
Functions
| Name | Description |
toOklab(color)
|
Converts OKLCH to Cartesian Oklab coordinates.
|
toOklch(color)
|
Converts Cartesian Oklab to lightness, chroma, and hue.
|
withChroma(color, chroma)
|
Returns a copy of an OKLCH value with raw chroma replaced.
|
withHue(color, hue)
|
Returns a copy of an OKLCH value with raw stored hue replaced.
|
withLightness(color, lightness)
|
Returns a copy of an OKLCH value with raw lightness replaced.
|
Structs
| Name | Description |
OklabHue
|
Stores an Oklab-family hue in degrees.
|
Oklch
|
Stores a color as Oklab lightness, chroma, and hue.
|