color-js/color.js

New achromatic logic in LCH is not sufficient for all achromatic colors

Closed this issue · 1 comments

This is due to recent changes on main.

> new Color("white").to('lch').coords
[ 100, 0, null ]
> new Color("gray").to('lch').coords
[ 53.58501345216902, 2.220446049250313e-14, 270 ]
> new Color("darkgray").to('lch').coords
[ 69.23779560557699, 5.978733960281817e-14, 338.1985905136482 ]

I would argue we don't need a super tight check for achromatic chroma. If the expectation is exact zero for null hue or nearly approaching such, that will not be sufficient. As a matter of fact, I would suggest being a bit loose to account for errors introduced by converting to other spaces and round tripping. Some conversion algorithms may be less accurate than others in some cases.

The only actual change in logic was that the epsilon is now smaller.
What is the minimum epsilon that would not have these issues?