When I rebuilt the color palette generator on my tools site, I had to decide which color space to do the maths in. HSL is the obvious choice. It's also wrong in a way that's easy to see.
Here are two colors with exactly the same HSL lightness:
--yellow : hsl ( 60 100 % 50 % ) ; /* #ffff00 */ --blue : hsl ( 240 100 % 50 % ) ; /* #0000ff */
Enter fullscreen mode
Exit fullscreen mode
Put white text on both. On the blue it's perfectly readable. On the yellow you can barely see it. So whatever "50% lightness" means, it isn't what your eyes see.
How far off it is
HSL lightness is just arithmetic on the red, green and blue values. It knows nothing about how bright each color looks to a person. OKLCH does: its L is designed to match perceived lightness.
I ran six colors through both.…