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: Robert Bradford via GitHub <sysbot+gh@w3.org>
Date: Thu, 12 Aug 2021 16:57:19 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-897804888-1628787438-sysbot+gh@w3.org>
I was wondering a similar thing. For example, we are maintaining a component library. In one of the components, we would like one of its elements to have a semi-transparent background color based on the `currentcolor`. Something like the following:

```html
<div class="wrapper">
  <div class="my-component">
    <p>Some text</p>
    <div class="my-component__semi-transparent-thing"></div>
  </div>
</div>
```

```css
.wrapper {
  background: darkslateblue;
  color: white;
}

.my-component__semi-transparent-thing {
  background-color: rgb(from currentcolor r g b / 50%);
}
```

We would like to use `currentcolor` because from the component's perspective, it doesn't necessarily know its context. Of course we could use a CSS custom property, but with `currentcolor` working so well elsewhere, it would be nice to use it here too.

-- 
GitHub Notification of comment by robertwbradford
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6168#issuecomment-897804888 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 16:57:20 UTC

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