-
Notifications
You must be signed in to change notification settings - Fork 692
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-fonts] [palettes] Should calc() or var() be allowed inside @font-palette-values? #6631
Comments
Isn't |
Computed GOTO considered harmful. Palette numbers are font-specific and are determined by inspecting the font, so at that point they are known and should be considered constant values. Doing computation on them has no realistic use-case that I can see. Using |
To be fair, I'm uncomfortable with special-purpose restrictions like this; they make the language more complex to learn and use. A |
I can't think of a use case for calc(). The following code doesn't work in Safari Technology Preview 134.
Changing CSS custom properties with Javascript is an easy way to do theming. If somebody wanted a color font to be different colors depending on dark or light theme, for example, being able to update a custom property with javascript would seem like the simplest approach for web developers. |
Funny, we've literally just hit the same question about 30 minutes while bring our implementation up to date with recent changes. I agree with @o-t-w; in particular I think We've implemented it as a special case, reevaluating the @font-palette-values declarations at the point the font is used to expand |
As long as variables in the palette are evaluated in the context of the root element (which would satisfy @o-t-w’s example), and not the element they’re applied to, implementation shouldn’t be too difficult. The thing that would make implementation difficult is if different elements that reference the same @font-palette-values rule end up getting different palettes because it’s evaluated differently each time. |
This is also related - web-platform-tests/wpt#31517. None of your recent tests covered If you're going to support currentColor - and I think it's important that we do - then you're necessarily going to be reevaluating these palettes at the time of use. |
Yeah - it's important to us that the colors inside the |
…oot element's context Fixes w3c#6631.
…oot element's context Fixes w3c#6631.
…oot element's context Fixes #6631.
CC @andruud |
Allowing However, allowing Going in the "author env()" direction seems more approachable, depending on its shape. There are other reasons we may need things like that as well, e.g. #6641. |
Filed as #6931, let's continue discussing |
Should authors be able to do things like
base-palette: calc(3 + 4);
?This increases the implementation complexity, and I can't think of any use cases for it (since variables are not available in at-rules).
The text was updated successfully, but these errors were encountered: