Skip to content

[css-color][css-ui] Better Fallback for outline-color: invert #4611

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

Open
Crissov opened this issue Dec 17, 2019 · 3 comments
Open

[css-color][css-ui] Better Fallback for outline-color: invert #4611

Crissov opened this issue Dec 17, 2019 · 3 comments
Labels
css-ui-4 Current Work

Comments

@Crissov
Copy link
Contributor

Crissov commented Dec 17, 2019

The support for outline-color: invert is very limited #423, because, as I understand it, it is complicated to achieve the effect with current technology while it used to be simple when fewer layers of abstraction stood between hardware and browser. CSS-UI therefore allows browsers to ignore the value altogether. Can we perhaps do a little better? I propose that browsers should, instead, fall back, to inverting the computed value of the background-color property. In some simple cases with the same plain background, this will actually yield the expected visual result.

With this convention in place, invert might even become useful as a keyword for other *-color properties, but, to avoid cycles, not for background-color itself and thus not for the <color> type.

  • caret-color
  • color
  • text-emphasis-color
  • text-decoration-color
  • border-color
  • column-rule-color
  • stroke-color
  • fill-color

Plans and proposals for more sophisticated color modifications should not be affected by this.

@Crissov Crissov changed the title [css-color][css-ui] Better Fallback for outline-color: invert; and Introduce Elsewhere [css-color][css-ui] Better Fallback for outline-color: invert Dec 17, 2019
@Crissov
Copy link
Contributor Author

Crissov commented Dec 17, 2019

This might create an infinite loop then:

foo {
  color: invert;
  background-color: currentcolor;
}

PS: CSS UI implies external knowledge about exactly what it means to invert a color, probably rgb(calc(100% - red(currentcolor)) calc(100% - green(currentcolor)) calc(100% - blue(currentcolor)) / opacity(currentcolor)).

@frivoal
Copy link
Collaborator

frivoal commented Jul 25, 2020

Most of the time, the background color is transparent. What do you do then?

@Crissov
Copy link
Contributor Author

Crissov commented Jul 26, 2020

Since transparent is defined as transparent black, the inverse would probably be transparent white, which would not be very useful indeed. In many cases, it would perhaps be useful to fall back to currentcolor instead.

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

No branches or pull requests

3 participants