-
Notifications
You must be signed in to change notification settings - Fork 715
[css-color] What to do if there's no valid fallback? #349
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
Comments
I agree there should be a defined fallback and that black is the obvious one. On balance, I like the opaque black better - if it is an authoring mistake, it is easily spotted and corrected by them. Invisible ink is just mysterious to the author trying to debug their stylesheet.. |
k, i used opaque black |
I don't know if it would be the right answer, but I think there are more alternatives to consider than black and transparent black. What about using currentColor? This might not be a great fallback when used as a background color, but neither is black, and when used as a foreground color, it might end up being useful more often than black is. |
I believe @frivoal is right, |
Maybe we want to define something like current-background-color. In general, that'd be useful. and if we had that, maybe the fallback of color() should be context sensitive, be either currentColor or current-background-color depending on the property it's used it. Or maybe that's overkill, I'm not sure. |
The current spec doesn't define what color to resolve
color()
to when all the options cause fallback. For example, what do you get fromcolor(nonsense-colorspace .1 .2 .3)
?I think the only two reasonable options are opaque black, or transparent black. Given that the opacity defaults to 100% if omitted, I'm leaning toward opaque black.
On the other hand, we default to "transparent" in similar cases, like
image()
, which represents a transparent image with no intrinsic dimensions if all the alternatives are invalid, exactly as if you'd putimage("nonsense", transparent)
. This might be explainable by the different assumed contexts - most elements don't have background images so defaulting to invisible is fine, but most colors are used to make things visible so defaulting to an opaque color is better.The text was updated successfully, but these errors were encountered: