All posts

Engineering

Choosing colors I can adjust by eye

·2 min read

When I chose colors for the school website, I wanted to be able to darken a link without also changing what color it looked. HSL seemed to give me a dial for that. Then I put yellow and blue next to each other at 50 percent lightness.

Interactive comparison

HSL — 50% lightness

Non-uniform
YellowL: 50%
GreenL: 50%
RedL: 50%
CyanL: 50%
BlueL: 50%
HSL — perceived brightness
95%
72%
53%
79%
28%
vs

OKLCH — 0.6 lightness

Perceptually uniform
YellowL: 0.6
GreenL: 0.6
RedL: 0.6
CyanL: 0.6
BlueL: 0.6
OKLCH — perceived brightness
60%
60%
60%
60%
60%

HSL blue at 50% lightness appears 3.4× darker than HSL yellow at 50% lightness. In OKLCH, all five colors share identical perceived brightness.

Three separate adjustments

In OKLCH, I use L to adjust perceived lightness, C to adjust color intensity, and H to choose a hue. Holding lightness steady gives me a more consistent starting point as I move between hues. I still measure the contrast of the actual text and background together.

Where the decision lives

I give the palette values names once. A component asks for the primary link color or the page background. When I change the green I can see the effect across links, charts, and buttons together. If only one button needs a different state, I can see that decision in its component.

Read the palette used on this page ↗