Skip to content
/greyscale
No. 01 · Decide on purpose · Chapter 1 of 3

Equal numbers are not equal brightness

Murat Alpay · · 4 min read
Free

Set four chips to the same HSL lightness and saturation, and change only the hue. On paper, that's a palette. On screen, yellow shouts and blue sits down.

The numbers match. The brightness doesn't. HSL's L isn't how light a color looks, so you can be exact in the file and still ship a palette that feels uneven. Here is how I'd check for it, and what I'd use instead.

#HSL's lightness is arithmetic, not perception

HSL lightness is the average of the highest and lowest RGB channel. It doesn't care which channel is which. Eyes do. Green looks far brighter than red, and blue looks darkest of the three. So pure yellow and pure blue both come out at 50%, and yellow looks close to white next to the blue.

The quickest way to see it is to take the color out. Replace each chip with the grey that looks as light as it does.

hsl(h 90% 60%)Spread0
HSL lightnessEqual

Four hues at HSL lightness 60: Red, Yellow, Green, Blue.

Same HSL numbers, four hues. As greys, the numbers show how light each one looks, 0 to 100.

Four chips at one HSL lightness turn into four different greys. That spread is the unevenness you feel before you can name it.

You can run the same check on a real page. A grayscale filter weights the channels roughly the way eyes do, so colors meant to be equal should land on about the same grey. Be careful with tools that desaturate by dropping HSL saturation. They keep L, so every color lands on the same grey and the check passes when it shouldn't. I do this in the browser: filter: grayscale(1) on the body, then look for the color that jumps out.

#Siblings: hold L and C, turn H

OKLCH has three numbers: lightness, chroma (how colorful), and hue. Its lightness is designed to follow how light a color looks. So the rule for siblings is short. Keep L and C the same and change only H.

It matters most when something sits on the color. In HSL, a dark label that reads well on yellow can fail on blue. In OKLCH, one text color works for the whole set, because the backgrounds really are one lightness.

hsl(h 90% 60%)Dark text on each
One dark label can’t serve all four.Range2.8 to 16.0

hsl(h 90% 60%). Contrast of dark text: Red 5.0 to 1, Yellow 16.0 to 1, Green 12.8 to 1, Blue 2.8 to 1. One dark label can’t serve all four.

Hold the numbers, turn the hue. Under each chip, the contrast of its dark label.

I measured that on this page. Four chips at hsl(h 90% 60%), a dark label against the page background, #121212: 2.8:1 on blue and 16:1 on yellow. Same numbers, not the same brightness. One label can't serve both.

Notice the yellow. At the same lightness as the blue, it's an olive, not a lemon. That's the model being honest. A bright yellow is a lighter color, and if you want one, give it its own L and its own text color, on purpose.

Same L doesn't promise an identical look on every display and to every eye. Very colorful colors still read a little brighter than their L says. The promise is a much closer starting point than HSL, so the tuning you do by eye is small.

#Shades: keep the hue, step L evenly

A shade ramp has the same problem along the other axis. Step HSL lightness by 10 and the steps you see come out uneven: big jumps in the light half, small ones in the dark half. The blue also leans toward purple as it gets lighter, so the light end is a different blue from the dark end.

In OKLCH, keep H fixed and step L by the same amount. The steps look the same size, and the hue holds.

hsl(240 90% L)How light it looks
Step size5 to 13Hue drift21°

hsl(240 90% L). How light each shade looks: 93, 80, 67, 55, 46, 41, 34, 27, 19. Step size 5 to 13. Hue drift 21 degrees.

Nine shades of one blue, evenly spaced in each model’s numbers. The bars are the steps you see.

If blue-300 feels like a different family from blue-700, the token names aren't the problem. The model under them might be. A grayscale filter on the ramp makes the uneven steps obvious: two neighbors that are almost the same grey, and two with a gap.

#Gamut: let chroma taper at the ends

A ramp at one chroma usually doesn't fit on screen. sRGB holds a lot of chroma in the middle of a ramp and very little near white or near black. An oklch() value outside that range is still valid CSS. The browser has to bring it back in somehow, and that's recovery, not a choice you made.

So let chroma taper. Keep the hue and the lightness steps, and lower chroma at the ends to what the gamut can hold.

oklch(L 0.16 264)Chroma by step
One chroma for every step. The ends don’t fit.Outside sRGB4 of 9

Every step at chroma 0.16. 4 of 9 steps are outside sRGB, at the light and dark ends.

Grey is what sRGB can show at this hue, and it doesn’t move. Highlighted is what the ramp asks for past it, where the browser has to guess.

Design for the gamut you mean to support. If that's sRGB, keep every step inside it. If you're designing for wider-gamut screens on purpose, say so and test on one. OKLCH works in modern browsers. A hex fallback still helps when older browsers are a real requirement, but it can't make the color more vivid than sRGB allows. The lightest and darkest steps are the ones most likely to sit outside sRGB. I lower their chroma until they fit, then look at the whole ramp again.

#When this is overkill

If the palette is greys and one accent, there's nothing to balance. The accent is meant to stand out, and HSL or hex is fine for it.

A brand color you were handed stays as it is. Build the colors around it in OKLCH, but don't re-author the one you were given.

A quick prototype with one or two colors doesn't need any of this. The problem shows up when colors have to read as equals: chart series, status colors, tags, or several ramps that share token names. If fewer than three colors in a product have to feel equal, I skip this.

#What I don't know yet

With four hues, one L and one C hold up. I don't know how far that stretches. A chart with eight series asks for more hues at one lightness, and some hues run out of chroma in sRGB sooner than others. At some point you either lower C for all of them, or let a few differ and decide which. I haven't found a rule for that yet.

The numbers matching was never it. The family looking even is.

Subscribe

Issue 01 · Decide on purpose