Re: [csswg-drafts] [css-bg-opacity] Add `background-opacity` as an alternative to Relative Color (Color Module Level 5) (#8465)

Just to comment on one point:

> [Relative Colors from CSS Color Module Level 5](https://bugs.chromium.org/p/chromium/issues/detail?id=1274133#c3) which is unsupported by all browser and pretty complex.

Actually no, [looking at the results](https://wpt.fyi/results/css/css-color/parsing?label=master&label=experimental&aligned&view=subtest&q=relative) Safari has 100% passes (2076 / 2076) on RCS in the WPT tests, Chrome and Firefox are also working on it.

It is also pre-cleared (before CR) as [ready to ship](https://github.com/w3c/csswg-drafts/issues/7978)

Your example shows that RCS is pretty simple although there is no need to use `rgb()` there:

#### Option B
Using relative color from CSS Color Module Level 5
```css
:root {
  --c-primary: #e2273c;
}
.regular-background-with-opacity {
  background:  rgb(from var(--c-primary) r g b / 50%);
}
```
what happens if another stylesheet does 

```css
:root {
  --c-primary: color(display-p3 0 1 0);
}

You may be assuming that the color space used for the declaration and the one used for RCS have to match? If so, rest assured that they do not. Although your example will still work, there will just be rgb values greater than 1 00% or less than 0.

Either way, this seems like a simple and easy way to alter the alpha value. Your example is not demonstrating the complexity you mention, do you have a better example?

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


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

Received on Friday, 17 February 2023 22:32:05 UTC