-
Notifications
You must be signed in to change notification settings - Fork 642
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-color-4] The color() function <ident> doesn't seem to be future proof #4654
Comments
This is a very good point. I agree with your concern. There were similar issues with the font property, which were solved by requiring any clashes to be quoted (you can reference a font that is actually called "serif", but In this case, maybe it makes sense for the predefined ones to be unquoted and for the user-supplied ones to always be quoted? @tabatkins what do you think? |
Yeah, letting user-supplied names play in the exact same namespace as predefined ones has bitten us many times in the past. Either forcing user-defined to be strings or requiring them to be --idents would work; I don't have a strong preference for which. Usually we use strings when the names come from outside the control of the author, and let author-supplied names remain idents, so I guess I lean slightly toward --idents, since the names are declared by the author in the @color-profile rule. |
I have a slight preference for forcing the user-defined ones to be strings, because I expect them to be less common, and it means the predefined ones like It is also more in keeping with fonts, where the predefined (generic) ones are unquoted and the author-supplied ones should be quoted (a design error, must would have been better) |
I lean toward |
Uch, please no more ugly double hyphens – or at least not as prefixes (i. e. |
They wouldn't, that's the point. The predefined ones stay exactly as they are, it's the user-defined that have to do something else.
They're well-established and will show up more regardless. Names in strings are the rare thing; as I said, we use them pretty much exclusively for names that come from outside CSS, and thus have no guarantees of being friendly to CSS tokenization rules (like font-face names, variation axis names, lang codes, etc.) We have no precedent for using them for things defined by the CSS author. (@font-face just works with the existing weird pattern that font-family established since CSS1; if we were doing it today it would probably instead be that all "local" fonts required strings, and all @font-face required --idents.) |
@tabatkins is there a procuction for Or is it the <custom-property-name> which seems to have the same link as custom properties ? |
Ah yeah, I don't have a good general-purpose production for it. I can add one in custom properties, I guess. (And I don't know what you mean, |
Done, you can refer to |
@karip thanks for reporting this. Predefined spaces now use <ident> while custom spaces use <dashed-ident>, so are future proof against later additions to the predefined spaces. |
Should some specification mention that custom properties (CSS variables) and custom color profiles live in different namespaces? It's possible to use the same identifier as a CSS variable and custom color profile and they don't override each other, or do they? Example:
|
They have no relation to each other, yes. No need to call it out specially; they're just different concepts. It's the same as creating an |
The color() function's
<ident>
can be either a predefined colorspace or a custom identifier. Custom identifiers can't be predefined colorspaces ('srgb', 'rec-2020', etc.): "predefined colorspace keywords .. are excluded from this<custom-ident>
".It seems that it won't be possible to add new predefined colorspaces because they could potentially break user defined custom identifiers:
Let's say I create a web page which uses my colorspace with a custom identifier 'rec-2100'. Then, the CSS working group decides to create a new predefined colorspace called 'rec-2100'. Since predefined colorspaces can't be used as custom identifiers, the new predefined colorspace will override my colorspace and breaks my web page.
Would it be better to differentiate custom identifiers with quotes or something so that they won't clash with predefined colorspaces?
Or are you certain that there will never be new predefined colorspaces? I think there is a plan to add at least one predefined CMYK colorspace.
The text was updated successfully, but these errors were encountered: