Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two "variants" of color-mix() ?? #10573

Open
svgeesus opened this issue Jul 13, 2024 · 5 comments
Open

Two "variants" of color-mix() ?? #10573

svgeesus opened this issue Jul 13, 2024 · 5 comments
Labels

Comments

@svgeesus
Copy link
Contributor

svgeesus commented Jul 13, 2024

In CSS Values 5 I was astonished to read 5.3. Interpolated Color Values: the color-mix() notation

This specification extends the color-mix() functional notation as a mix notation accepting the following syntaxes:

<color-mix()> =
  color-mix( <progress> && <color-interpolation-method>?, <color>, <color> ) |
  color-mix( <color-interpolation-method>, [<color> && <percentage [0,100]>?]#{2} )

The used value of the first mix notation variant is equivalent to assigning the <progress> value, as a <percentage>, to the of the second <color> argument in the second variant. That is, color-mix(progress, color1, color2) is equivalent to color-mix(color1, color2 progress). See CSS Color 5 § 3 Mixing Colors: the color-mix() Function for the normative definition of the second variant.

Why is there a second "variant" of color-mix() defined, with zero discussion that I can recall, which is merely a permutation of the parameter order, and has zero tests in WPT, unlike the other "variant" which is widely implemented, with 1510 tests in WPT and part of Interop 2023?

@svgeesus svgeesus added css-values-5 css-color-5 Color modification labels Jul 13, 2024
@SebastianZ
Copy link
Contributor

This was added in 0d8967a, which references the related discussions, especially #6245 (comment).
@fantasai can surely explain more. Though it looks like it was added as an initial draft for generalized interpolation functions while the discussion is still going on.

Sebastian

@tabatkins
Copy link
Member

Thanks for digging up the ref, @SebastianZ! Yes, we discussed this last year; the reasoning is to give all the mixing functions a consistent grammar form so they can all benefit from all the mixing features, even if they have a legacy grammar that looks a little different.

@svgeesus
Copy link
Contributor Author

Thanks, @SebastianZ and @tabatkins

So, are any browsers implementing this, or expressing interest?

@tabatkins
Copy link
Member

At the moment, all of the mix functions are not yet implemented. But the mix functions in general have implementor interest; we needed them to solve font palette mixing, for example.

@cdoublev
Copy link
Collaborator

The "new" variant has an optional <color-interpolation-method>, while omitting in in the original syntax is still discussed in #10484 , but I do not see the people involved in the new variant taking part in that discussion, so: can you please tell me if there is a reason to specifically allow omitting it in the new variant, or do you ultimately want it to match the original variant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants