Re: [csswg-drafts] [css-color-5] How should negative percentages behave in color-mix()? (#6047)

I'll note that my "the hue is unchanged" is talking about the HSL hue; given that this is doing mixing in RGB, it seems reasonable to talk about the major sRGB cylindrical system.

If you look at the colors in LCH, you *do* get slight hue changes (using [this converter](https://www.nixsensor.com/free-color-converter/) just for ease):

* `rgb(100 0 0)` is `lab(19.37% 40.67 30.05)`, which is a hue of `atan2(30.05, 40.67)` or `36deg`
* `rgb(120 0 0)` is `lab(24.25% 46.28 36.88)`, which is a hue of `39deg`
* `rgb(0 100 0)` is `lab(36.24% -39.90 40.76)`, which is a hue of `134deg`
* `rgb(0 0 100)` is `lab(6.98% 34.17 -56.30)`, which is a hue of `301deg`

So, the output has a *slightly higher* hue then the input. However, this doesn't depend on which negative input you use: if you use negative green, the output can be considered *very slightly* "more greenish" (hue difference drops from `98deg` to `95deg`); if you use negative blue, the output can be considered *very slightly* "less blueish" (hue difference grows from `95deg` to `98deg`). These are opposite results! So any intuition about the hue changing as a result of the inputs is broken; there is no solid connection between the input hues and output hues in this case, just a slight unrelated drift as a result of the red becoming more vivid.

(The fact that the hue-differences are precisely opposite is actually a surprise; given that *any* negative color with a zero red channel will give identical results, and those colors span at least 160deg of hue angle, I'm pretty sure this is just a coincidence.)

-------------

It's possible that I'm doing the mixing *completely wrong*, and the result is *not* `rgb(120 0 0)`, but something else. If so, I'd love to know what the right procedure is; I've given a bunch of examples in this thread all using the same underlying math, and it appears that they have been implicitly accepted as correct so far.

If the end result is still some variety of pure red, tho, then my conclusions so far should still be right. Regardless, tho, I'd really appreciate any errors being pointed out.

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


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

Received on Wednesday, 31 March 2021 17:49:52 UTC