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

[css-values-5] Express which keywords are valid in calculations in syntax definitions #11505

Open
romainmenke opened this issue Jan 15, 2025 · 0 comments

Comments

@romainmenke
Copy link
Member

Some examples:

color: rgb(from purple r g calc( b / 2 ));
height: calc-size(auto, calc(size / 2));

Currently there is no way to express in syntax definitions which keywords are valid in which context.
This can only be done in prose.

This would be useful for static analysis tools (i.e. linters)

With the addition of the boolean expression multiplier there is bit of a precedent to define and communicate such things.

Could we use this or something similar for math expressions?

<modern-rgb-syntax> = rgb( [ from <color> ]?
        [ <number> | <percentage> | <math-function[ r | g | b ]> | none]{3}
        [ / [<alpha-value> | <math-function[ alpha ]> | none] ]?  )

Where <math-function[ foo ]> is equivalant to calc( <calc-sum[ foo ]> ) | min( <calc-sum[ foo ]> ) | ...

<calc-size()> = calc-size( <calc-size-basis>, <calc-sum[ size ]> )
@romainmenke romainmenke changed the title [css-values-5] Adding a way to express which keywords are valid in calculations in syntax definitions [css-values-5] Express which keywords are valid in calculations in syntax definitions Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant