Re: [csswg-drafts] [css-color] Adaptive Color Keywords black-or-white and white-or-black (#4623)

I'm not sure that adding a dependency to `background-color` is a good idea.

But if it's done, I would say that it would be better to go all the way, expose `backgroundColor` in `<color>`, handle cyclic dependencies like for `var()`, and cover your usecase with [`color-contrast`](https://drafts.csswg.org/css-color-5/#colorcontrast):

```css
color: color-contrast(backgroundColor white, black)
```

@frivoal proposed `backgroundColor` in #364, but it was rejected because `background-color` is not inheritable and usually you want the background of some ancestor, not the element itself.

But you can use variables:

```css
--background-color: #123456;
background-color: var(--background-color);
color: color-contrast(var(--background-color) white, black);
```

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4623#issuecomment-568289507 using your GitHub account

Received on Sunday, 22 December 2019 18:11:59 UTC