Skip to main content

oklch

Function oklch 

Source
pub fn oklch(lightness: f32, chroma: f32, hue: f32) -> Hsla
Expand description

Builds a color from OkLCH, the cylindrical form of the perceptually uniform Oklab color space.

Unlike HSL, rotating hue while holding lightness and chroma keeps the perceived brightness and vividness of every hue equal, so a generated color ring reads as one family instead of a raw rainbow.

lightness is 0.0 .. 1.0, chroma is an absolute Oklab distance (roughly 0.0 .. 0.37), and hue is in degrees. A request outside the sRGB gamut is clipped per channel, which costs a little chroma but not the hue.