CSS oklch() Function

The CSS oklch() function defines a color in the Oklab color space using cylindrical coordinates: Lightness, Chroma, and Hue.

Introduced in CSS Color Module Level 4, oklch() is widely considered the most practical and intuitive modern color format for web design. It pairs the familiar wheel-based controls of hsl() with true perceptual uniformity and access to wide-gamut screens (like Display P3), while eliminating the infamous “blue-to-purple shift” problem found in lch().

Syntax

The oklch() function accepts three space-separated values representing Lightness, Chroma, and Hue, plus an optional alpha transparency channel:

Parameters

Basic Examples

Here are some basic color examples specified using oklch():

Using oklch() in Style Sheets

The CSS specifications state that you can use oklch() wherever a CSS <color> value is accepted. For example, you can use oklch() to set the colors of text, backgrounds, and borders:

Specifying Transparency

An alpha channel can be added after a forward slash (/) to create semi-transparent colors:

Why OKLCH is Ideal for Design Systems

OKLCH is rapidly becoming the preferred color format in modern CSS frameworks and design systems for several reasons:

You can experiment with interactive OKLCH color selection, palette generation, and wide-gamut comparisons using our OKLCH Color Picker.

oklch() vs hsl() vs lch()

Here is how oklch() compares to traditional hsl() and earlier lch() models:

Feature hsl() lch() (CIELCH) oklch() (Oklab LCH)
Color Space sRGB only CIELAB (Unlimited gamut) Oklab (Unlimited gamut)
Perceptual Uniformity Poor (brightness varies wildly by hue) Good Excellent
Blue Hue Stability Shifts with saturation changes Shifts toward purple (CIELAB bug) Completely stable
Lightness Scale 0% to 100% 0 to 100 (or %) 0 to 1 (or %)
Saturation / Chroma 0% to 100% (artificially bounded) 0 to ~150 0 to ~0.37

Related Color Functions