HeadlinesBriefing favicon HeadlinesBriefing.com

CSS Color Precision: When 3 Decimal Places Are Enough

Hacker News •
×

3 decimal places are sufficient for CSS color values like oklch, according to a CSS minifier author. This insight emerged while refining csskit's color handling, revealing that rounding beyond this threshold wastes bytes without improving human perception. The author's test suite shows minifiers like csskit, which currently struggles with color pass rates, can benefit from this precision rule. dE00 delta-e values below 2.0 indicate colors are indistinguishable to humans, making values like oklch(.659 .304 234.752) effectively equivalent to their more precise counterparts. 2dp rounding shows promise for static colors but risks errors in complex operations due to accumulated rounding artifacts.