Re: [csswg-drafts] [css-color][css-images] Interpolation method / color space that favors chroma over lightness (#10135)

@argyleink 

So, I've implemented an example of Google's HCT blend as an example, and then did something similar to OkLCh. The results aren't exactly like Google's because they loose precision because they keep converting back to 8bit hex, but the idea is exactly the same. Again, not so magical once you now what is happening.

[Example](https://facelessuser.github.io/coloraide/playground/?code=from%20coloraide%20import%20Color%20as%20Base%0Afrom%20coloraide%2espaces%2ecam16_jmh%20import%20CAM16JMh%0Afrom%20coloraide%2espaces%2ecam16_ucs%20import%20CAM16UCS%0Afrom%20coloraide%2espaces%2ehct%20import%20HCT%0A%0Aclass%20GoogleCAM16JMh%28CAM16JMh%29%3A%0A%20%20%20%20NAME%20%3D%20%27cam16-jmh-google%27%0A%20%20%20%20SERIALIZE%20%3D%20%28%22--cam16-jmh-google%22%2C%29%20%0A%20%20%20%20ENV%20%3D%20HCT%2eENV%0A%0Aclass%20GoogleCAM16UCS%28CAM16UCS%29%3A%0A%20%20%20%20BASE%20%3D%20%27cam16-jmh-google%27%0A%20%20%20%20NAME%20%3D%20%27cam16-ucs-google%27%0A%20%20%20%20SERIALIZE%20%3D%20%28%22--cam16-ucs-google%22%2C%29%20%0A%20%20%20%20ENV%20%3D%20HCT%2eENV%0A%0Aclass%20Color%28Base%29%3A%20%2e%2e%2e%0A%0AColor%2eregister%28%5BGoogleCAM16JMh%28%29%2C%20GoogleCAM16UCS%28%29%2C%20HCT%28%29%5D%29%0A%0Agmap_hct%20%3D%20%7B%22method%22%3A%20%22raytrace%22%2C%20%22lch%22%3A%20%22hct%22%7D%0Agmap_oklch%20%3D%20%7B%22method%22%3A%20%22raytrace%22%2C%20%22lch%22%3A%20%22oklch%22%7D%0A%0Adef%20blend%28color1%2C%20color2%29%3A%0A%20%20%20%20c1%20%3D%20Color%28color1%29%2econvert%28%27hct%27%29%0A%20%20%20%20c2%20%3D%20Color%28color2%29%2econvert%28%27hct%27%29%0A%20%20%20%20chroma%2C%20tone%20%3D%20c1%5B1%3A-1%5D%0A%20%20%20%20return%20%5Bc%2eset%28%7B%27c%27%3A%20chroma%2C%20%27t%27%3A%20tone%7D%29%2efit%28%27srgb%27%2C%20%2a%2agmap_hct%29%20for%20c%20in%20Color%2esteps%28%5Bcolor1%2C%20color2%5D%2C%20space%3D%27cam16-ucs-google%27%2C%20out_space%3D%27hct%27%2C%20steps%3D500%29%5D%0A%20%20%20%20%0ASteps%28blend%28%27red%27%2C%20%27blue%27%29%29%0Alight%2C%20chroma%20%3D%20Color%28%27red%27%29%2econvert%28%27oklch%27%29%5B0%3A2%5D%0ASteps%28%5Bc%2eset%28%7B%27l%27%3A%20light%2C%20%27c%27%3A%20chroma%7D%29%2efit%28%27srgb%27%2C%20%2a%2agmap_oklch%29%20for%20c%20in%20Color%2esteps%28%5B%27red%27%2C%20%27blue%27%5D%2C%20space%3D%27oklab%27%2C%20steps%3D500%2C%20out_space%3D%27oklch%27%29%5D%29%0A%0A%20%20%20%20).

<img width="1343" alt="Screenshot 2024-03-25 at 6 18 49 PM" src="https://github.com/w3c/csswg-drafts/assets/1055125/95963ea0-347a-4082-8091-625f22dd92ce">



-- 
GitHub Notification of comment by facelessuser
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10135#issuecomment-2019153209 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 26 March 2024 00:22:47 UTC