- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Sat, 16 May 2020 05:27:05 +0000
- To: public-css-archive@w3.org
After playing a little bit with interpolation code, I stumbled on the same issue @svgeesus is describing, and it's nasty. Consider this (actual real example with real colors): ```css --color-red: hsl(0 80% 50%); --color-blue: hsl(210 80% 55%); --color-red-blue: color-mix(--color-red, --color-blue); /* using default lch interpolation */ ``` `--color-red` is `hsl(0 80% 50%)` so `lch(49.857% 91.826 38.012)` in LCH. `--color-blue` is `hsl(210 80% 55%)` so `lch(56.522% 55.117 267.397)` in LCH Therefore, `--color-red-blue` is: - With simple linear interpolation: `lch(53.19% 73.471 152.704)` which is `hsl(154.025 100.002% 28.685%)` (after gamut mapping). - With shortest arc interpolation: Blue becomes `lch(57% 55 -93)` (`hsl(210, 65.455%, 55%)`) and their midpoint is `lch(52.706%, 64.871, 332.17)` which is `hsl(309 51% 54%)` (after gamut mapping) Green is certainly not what I have in mind when combining red and blue. And basically, based on what angle you start with, you could get any angle back. The result is nonsensical, and if your color is not lch there is no way to control that. My calculations: ![image](https://user-images.githubusercontent.com/175836/82111593-4e7a4f00-9714-11ea-9db2-8a57db5e1e0e.png) -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4735#issuecomment-629591324 using your GitHub account
Received on Saturday, 16 May 2020 05:27:07 UTC