Re: [csswg-drafts] [css-values-4] inherit() function: like var() for parent value, for any property (#2864)

Here's a use-case I'm thinking of; can you help me with how `parent()` may or may not be useful here?  It draws off of the `color-contrast` example above.

I have a web component (pfe-layout) with styles:
```css
:host {
    background-color: #eee;
}
```

Containing a nested component (pfe-type) responsible for typography with styles:
```css
:host {
  color: color-contrast( inherit(background-color) , white, gray, black );
}
```

Now I could use a custom property to inherit the background color from the parent and this use-case works great, but what if an external stylesheet jumps in and sets:
```css
pfe-layout {
    background-color: #252527;
}
```

The external stylesheet would have to be aware of the custom property's existence in order to correctly update the stack.  We can do this with documentation, etc.  A nicer experience for all involved is some form of inheritance support where pfe-type can look up it's most recent background-color context.  Maybe that's not relevant to this specific discussion.  I share the use-case in case it might be.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 12 April 2021 18:48:28 UTC