W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2020

[csswg-drafts] [css-color4] Precision issues when converting colors between Lab and sRGB (#5262)

From: Igor Snitkin via GitHub <sysbot+gh@w3.org>
Date: Thu, 25 Jun 2020 11:48:19 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-645496830-1593085698-sysbot+gh@w3.org>
snigo has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color4] Precision issues when converting colors between Lab and sRGB ==
I'm working on my own Lab color library implementing conversions according to CSS color4 spec and keep noticing small inconsistencies when converting from Lab color space to sRGB, resulting in following:
```js
// pseudo
color('#f00').toLab().toRgb(); // #fe0000
```

I've checked whole sRGB color wheel (at saturation 1 and lightness 0.5) and xyz values on conversion back from Lab are **steadily** lower in the range [0.0005 - 0.004] that is enough for side effects.

Conversions `sRGB -> XYZ -> sRGB`, `Lab -> XYZ -> Lab` and `sRGB -> XYZ(D65) -> XYZ(D50) -> XYZ(D65) -> sRGB` are precise as expected which means that either conversion between sRGB and XYZ or between Lab and XYZ are off a bit.

I wonder if anyone else experienced the same result?


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5262 using your GitHub account
Received on Thursday, 25 June 2020 11:48:21 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:28 UTC