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

Luckily we decided in the direction I like, but I'd still like an answer to the color-mixing question I asked above; Chris strongly implied in the call that the results made perfect sense within proper color math and I'm misunderstanding things, and I *desperately* want to know where exactly I'm going wrong, so I can continue to contribute to Color editing usefully:

> And similarly, this is a strike against Lea's earlier explanation of it being intuitive with "The actual hue is indeed less red"; because the hue doesn't change at all when I mix with green. And it's not because purple and green are opposites, either; mixing red with negative green as in color-mix(rgb, rgb(100 0 0), rgb(0 100 0) -20%) resolves to rgb(120 0 0), a brighter red. The hue only changed because both input colors touched the red channel; any combo that uses independent channels will leave the hue unchanged from the positive-% color.

The example mixes (positive) middle-red with (negative) middle-green. The hue does not change *at all* - it doesn't become less green, or more red, or anything of the sort. All that changes is the saturation - you get a more vivid red. And no clamping occurs either; inputs, outputs, and intermediates all stay within the sRGB gamut.

You get identical results if you used a negative middle-blue - the result is a more vivid red. So coming from either direction of the hue wheel, you get the exact same result; it thus can't be due to the specific location of the negative color. (In fact it's due to the positive and negative color having the same ratio of their shared non-zero channels; *any* negative color paired with a red (with a single non-zero channel) will solely adjust the saturation of the red, it's just a question of *by how much* it gets adjusted. Anything between "blue" and "green" gives the same results as above (increasing the saturation); anything closer to red will give a smaller increase, or perhaps decrease the saturation, depending on the exact color.)

Is my math wrong? If so, what should I be doing instead?

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6047#issuecomment-811249751 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 16:54:48 UTC