W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2020

[csswg-drafts] [css-color-5] Which color do percentages in color-mix() apply to? (#5258)

From: Lea Verou via GitHub <sysbot+gh@w3.org>
Date: Thu, 25 Jun 2020 00:07:15 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-645053628-1593043633-sysbot+gh@w3.org>
LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-5] Which color do percentages in color-mix() apply to? ==
I've just seen [this discussion](https://github.com/w3ctag/design-reviews/issues/526) and [this PR](https://github.com/w3c/csswg-drafts/pull/5256) by @dbaron about an error in the calculations for `color-mix(red, yellow 65%)` and noticed something else: The calculations are done as if this means 65% red and 35% yellow. 

However, it is not defined anywhere which color the percentage applies to. This is all that I can see [mentioned](https://drafts.csswg.org/css-color-5/#color-mix) about the <number-percentage>:
> When a plain number or percentage is specified (without a color-adjuster), it applies to all color channels in the given colorspace equally.
> If the plain number or percentage is omitted, it defaults to 50% (an equal mix of the two colors).

I think it would make much more sense to have it apply to the color it's closer to, i.e. yellow. Not only is this easier to read and more natural, but it also extends nicely to [multiple colors, which we're already discussing](https://github.com/w3c/csswg-drafts/issues/4711). In fact, @una in this thread [used such a syntax naturally](https://github.com/w3c/csswg-drafts/issues/4711#issuecomment-582682708).

If co-editors @svgeesus @una @argyleink agree, I could make the change.

PS: While we're at it, do we really need a `<number-percentage>`? All examples I've seen everywhere, including ours use a percentage.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5258 using your GitHub account
Received on Thursday, 25 June 2020 00:07:17 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:28 UTC