CSS Reference ยท Functions
The lch() function
Reference for the CSS lch() function: CIE LCH lightness, chroma and hue, wide-gamut colors, alpha, hue interpolation, and live editable examples.
The lch() function is the polar form of CIE Lab. Instead of the a and b axes it takes a chroma (how colorful) and a hue angle. That makes it friendlier than lab() for design work: keep lightness and chroma, rotate the hue, and you get colors of similar weight.
.tag { background: lch(60% 70 250); }
Try it
The top row keeps L and C fixed and only turns the hue. The bottom row fades from gray to a vivid blue as chroma grows.
Syntax
lch(L C H) lch(L C H / A) lch(from <color> L C H / A)
Syntax and arguments
| Argument | Description |
|---|---|
L |
Lightness, a number 0โ100 or a percentage. |
C |
Chroma, from 0 (gray) upward. A number (practically up to about 150) or a percentage, where 100% equals 150. |
H |
Hue, a number (degrees) or an angle. 0 is near magenta-red, and it wraps at 360. |
A |
Optional alpha, number 0โ1 or percentage. |
Usage notes
- Hue is not the same as in
hsl(). The numbers refer to a different wheel, solch(60% 60 250)is not the colorhsl(250 ...). - Gamut limits depend on L and H. The maximum useful chroma varies: very light or very dark colors, and some hues, cannot be very colorful. Values too high are clipped or mapped by the browser.
- Even steps, mostly. Lightness is much more uniform than in
hsl(), but blues can shift toward purple when chroma is high;oklch()fixes this and is usually the better choice for new palettes. - Hue interpolation. In gradients and
color-mix()you can pick how the hue travels:shorter,longer,increasingordecreasing. - Achromatic colors. With chroma near
0the hue is meaningless; browsers treat it as missing when interpolating.
Browser support
Supported in current versions of all major browsers; check a compatibility table for older ones.
Related
lab()โ rectangular formoklch()โ improved versionhsl()- Lesson: Modern color