freecoding.school100% FREE · NO SIGNUP
Cascade FallsISSUE #11 of 33

colors · hsl · hsla · oklch

StylaVSThe Specificity Sphinx
Styla sayshsl() describes color as hue, saturation, lightness — the most human-friendly format — and oklch() is the modern upgrade.

hsl(258 100% 76%) reads as a hue angle (0-360), saturation %, and lightness %. Rotating the hue or nudging lightness is intuitive — great for palettes and hover states. oklch() is a newer perceptually-uniform space that keeps brightness consistent across hues.

Power-ups you unlock

The Specificity Sphinx attacks — common mistakes

Boss battleBuild three shades of one hue by changing only the lightness in hsl().

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>div{padding:14px;color:#06040d}.a{background:hsl(258 100% 80%)}.b{background:hsl(258 100% 65%)}.c{background:hsl(258 100% 50%)}</style></head><body style="background:#06040d"><div class="a">light</div><div class="b">mid</div><div class="c">dark</div></body></html>
▶ Open the interactive comic issue
‹ Colors · Names · Hex · Rgb · RgbaBackgrounds · Color · Image · Gradient ›