lch()
Example
.tag {
background: lch(0.7 40 250);
}.tag {
background: lch(70% 40 250);
}In lch() lightness runs from 0 to 100, so a value under 1 renders almost black.
Common mistakes
- Writing lightness as a value under 1, which gives near-black.
- Reusing
hsl()hue numbers, which point to different colors inlch().
Key points
- Lightness is a percentage or a number from 0 to 100, and hue is an angle in degrees.
- High chroma values that leave sRGB have a fallback declared first.
- Blue palettes use
oklch(), sincelch()blues shift toward purple as lightness changes.
Interview questions
What is the difference between lch() and oklch()?
Both use lightness, chroma and hue. oklch() is built on Oklab, which keeps hues steadier, and its lightness runs from 0 to 1 instead of 0 to 100.
What is chroma in lch()?
Chroma is how vivid the color is, from 0 for gray upward. It has no fixed maximum, and very high values fall outside what screens can show.