Too Much Color

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A deep dive into how many decimal places are actually needed when writing CSS colors. Using the Delta-E perceptual difference formula (dE00 and dEOk), the author demonstrates that 3 decimal places is sufficient for oklch/oklab (0-1 range channels), 1dp for lab/lch (larger range channels), and integers for sRGB. The analysis covers static colors, chained color math with calc() and color-mix(), cross-space conversions, hue rotation accumulation, and alpha values. The conclusion is a simple static lookup table mapping color spaces to per-channel decimal places, implemented in the csskit CSS minifier.

20m read timeFrom keithcirkel.co.uk
Post cover image
Table of contents
How do you tell if two colours look the same?So what can we do with this?Okay so 2 decimal places is fine?If hue's perceptual limit is 0dp we could round hues to integers then?What about sRGB notations like hsl or rgb?What about edges of the colour space? Does 3dp hold uniformly?Do browsers optimise this stuff?Conclusions

Sort: