- From: Isaac Muse via GitHub <sysbot+gh@w3.org>
- Date: Wed, 23 Feb 2022 13:31:14 +0000
- To: public-css-archive@w3.org
I don't think Color.js has quite implemented things yet to work the same with Oklch. Notice the Hue shift in your example for `colorB`: ` color(oklch 0.57 0.1 219)`. If hue was held constant in oklch by just reducing chroma, you'd only see a slight change in hue due to clipping. I suspect this may be done in Lch still. You can see here that single colors do, in fact, have the same issue. It is not related to interpolation: [live example](https://facelessuser.github.io/coloraide/playground/?code=colorALAB%20%3D%20Color%28%27lab%2850%25%2C%20-127%2C%20-127%29%27%29%0AcolorAOKLCH%20%3D%20colorALAB%2econvert%28%27oklch%27%29%3B%0AcolorA%20%3D%20Color%28%27color%28--oklch%200%2e42%201%2e95%20191%29%27%29%0AcolorB%20%3D%20colorA%2efit%28%22srgb%22%2C%20method%3D%27oklch-chroma%27%29%0AcolorC%20%3D%20colorB%2econvert%28%27srgb%27%29%0AcolorA%2C%20colorB%2C%20colorC) We can see in the example that hue is held pretty much constant with only mild deviations in hue in lightness due to clipping. ```py >>> colorALAB = Color('lab(50%, -127, -127)') >>> colorAOKLCH = colorALAB.convert('oklch'); >>> colorA = Color('color(--oklch 0.42 1.95 191)') >>> colorB = colorA.fit("srgb", method='oklch-chroma') >>> colorC = colorB.convert('srgb') >>> colorA, colorB, colorC (color(--oklch 0.42 1.95 191 / 1), color(--oklch 0.42898 0.0739 190.78 / 1), color(srgb 0 0.3612 0.34904 / 1)) ``` And we get the same weird colors that were seen when interpolating: <img width="199" alt="Screen Shot 2022-02-23 at 6 27 09 AM" src="https://user-images.githubusercontent.com/1055125/155328467-fa047ee5-2b7f-4c2c-ad9c-66ca81730285.png"> -- GitHub Notification of comment by facelessuser Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7071#issuecomment-1048784943 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 23 February 2022 13:31:16 UTC