Skip to content

[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

Closed
tabatkins opened this issue Jul 27, 2016 · 5 comments
Closed

[css-color] What to do if there's no valid fallback? #349

tabatkins opened this issue Jul 27, 2016 · 5 comments
Assignees
Labels
css-color-4 Current Work

Comments

@tabatkins
Copy link
Member

The current spec doesn't define what color to resolve color() to when all the options cause fallback. For example, what do you get from color(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 put image("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.

@tabatkins tabatkins added the css-color-4 Current Work label Jul 27, 2016
@svgeesus
Copy link
Contributor

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..

@svgeesus svgeesus added the ready label Jul 27, 2016
@tabatkins
Copy link
Member Author

k, i used opaque black

@frivoal
Copy link
Collaborator

frivoal commented Jul 28, 2016

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.

@Crissov
Copy link
Contributor

Crissov commented Jul 28, 2016

I believe @frivoal is right, currentcolor would be the desired fallback for foreground properties like color and border-color, but transparent would be more appropriate for background-color etc. Using black (or white or transparent) everywhere would be harmful in more cases. What you really want is something like partial inherit or default.

@frivoal
Copy link
Collaborator

frivoal commented Jul 28, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-color-4 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants