W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2021

Re: [csswg-drafts] [css-color-5] What should the behavior of the CSS Color 5 color functions be when passed `currentcolor` as <color> (#6168)

From: Emilio Cobos Álvarez via GitHub <sysbot+gh@w3.org>
Date: Thu, 12 Aug 2021 20:23:01 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-897943038-1628799780-sysbot+gh@w3.org>
Sorry I missed this ping before.

@weinig @tabatkins resolving these at computed value time would break `currentcolor` when inheriting.

My point is that something like `color-mix(in lch, currentcolor 40%, palegoldenrod)` should somehow preserve the `currentcolor` component in the computed value, otherwise descendants that change `color` will get the wrong color.

Here's a test-case that shows what I meant. The expected output is greenish, but if you resolve `currentColor` at computed-value time, then you will get red.

I think Firefox's behavior is correct here (WebKit doesn't support `color-mix(..., currentColor, ...)` afaict)?

```html
<!doctype html>
<style>
  div {
    width: 100px;
    height: 100px;
  }
  .outer {
    background-color: color-mix(in srgb, currentcolor 90%, red 10%);
    color: red;
  }
  .inner {
    background-color: inherit;
    color: green;
  }
</style>
<div class="outer">
  <div class="inner"></div>
</div>
```

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 12 August 2021 20:23:03 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:42 UTC