Content-Length: 255884 | pFad | http://github.com/w3c/csswg-drafts/issues/9658

75 [css-values] Alternative, weighted mean syntax for `calc-mix()` · Issue #9658 · w3c/csswg-drafts · GitHub
Skip to content

[css-values] Alternative, weighted mean syntax for calc-mix() #9658

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

Open
Crissov opened this issue Nov 30, 2023 · 1 comment
Open

[css-values] Alternative, weighted mean syntax for calc-mix() #9658

Crissov opened this issue Nov 30, 2023 · 1 comment

Comments

@Crissov
Copy link
Contributor

Crissov commented Nov 30, 2023

This started out as a comment to #9343 and is obviously a revival of my suggestion in #4700.

With their shared use of a single <progress> parameter, the mix functions are currently all limited to two values, start and end. While some individual alternative syntaxes support specifying a weight per entry, calc-mix() does not.

The alternative syntax of the image mix function cross-fade() even supports mixing an arbitrary number of (weighted) images – this includes colors, while the color blending function color-mix() is restricted to two values.

  1. If this is useful for images, I would expect that authors would sometimes find a need to mix together multiple values of other types as well.
  2. If the WG agreed with this assumption, calc-mix() in particular would need an alternative syntax. Alas, this could not use the established notation for the weights of values, because ”20% 80%“ would be ambiguous.
    (Note that the optional weight, <percentage [0,100]>?, precedes the value in the grammar for cross-fade() and follows it for color-mix(), but && means ‘any order’.)
    For linear interpolation of percentages, the order might be irrelevant, but authors may want different ones.
  3. If this was the case indeed, the best way to allow more interpolation methods would probably be to support the various kinds of weighted means (arithmetic, geometric, harmonic, …) – or a generalized mean. [css-values] Function(s) for Standard Means #4700
  4. If syntax for means was to be introduced, ”calc-mix“ may not the best choice of a name.

Compilation of current grammar

<calc-mix()> = 
  calc-mix( <progress>, <calc-sum>, <calc-sum> )

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

<cross-fade()> =
  cross-fade( <progress>, [ <image> | <color> ], [ <image> | <color> ] ) 
  |
  cross-fade( <cf-image># )
<cf-image> = <percentage [0,100]>? && [ <image> | <color> ]

<transform-mix()> = 
  transform-mix( <progress>, <transform-list>, <transform-list> )

<mix()> =
  mix( <progress> ';' <whole-value> ';' <whole-value> ) 
  |
  mix( <progress> && of <'animation-name'> )
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-values] Alternative, weighted mean syntax for `calc-mix()` , and agreed to the following:

  • RESOLVED: Close issue as resolved by https://github.com/w3c/csswg-drafts/issues/6245#issuecomment-2685746280
The full IRC log of that discussion <fantasai> TabAtkins: crissov wanted a weighted average function
<fantasai> TabAtkins: which is doing exactly what he requested (other than differences in grammar)
<fantasai> TabAtkins: Weighted mean of calc() values, and interpolation thing, both are possible now with resolution to https://github.com//issues/6245#issuecomment-2685746280
<fantasai> RESOLVED: Close issue as resolved by https://github.com//issues/6245#issuecomment-2685746280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Tuesday Afternoon
Status: Friday morning
Development

No branches or pull requests

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/w3c/csswg-drafts/issues/9658

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy