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

> @svgeesus
> 
> > 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.
> 
> Safari has it under Experimental feature which mean it will probably not ship in the next stable release.

Nor would the property you propose. Though Safari passing all the tests is a good indicator that their implementation is ready to ship.

Having said that, @svgeesus, https://bugs.webkit.org/show_bug.cgi?id=245970 indicates that the WPT tests don't cover system colors or `currentcolor` yet.

> > Your example shows that RCS is pretty simple although there is no need to use rgb() there:
> 
> I'm not sure what you mean here. You copy pasted the same code block. Maybe my exemple is wrong, I did not test it. It was more meant to understand my proposal.

I guess, @svgeesus' point is that you proved with your example that your claim that the relative color syntax is "pretty complex" isn't true.
It is more to write than your proposed property but also far more powerful.

And the note regarding `rgb()` was just a hint that there are other color spaces and functions besides `rgb()` now. Though, as far as I understood, that hint is just a side note and irrelavant to the feature proposal.

> @SebastianZ
> 
> > Another way to achieve this would be via image manipulation
> 
> But that would prevent you from using `background-color` and `background-image` togerther,

No, you could still use them together. The point is just that the opacity is only applied to the background image and not the color. The example defines a color as image and changes its opacity. The `background-color` stays unchanged.

> > Having said all that, this issue is actually a duplicate of #4996
> 
> That ticket hasn't seen any update in 3 years. But I love the `pseudo-element` proposal !

Even when there wasn't any activity for years, it is still about the same topic. And you're welcome to add your comments there to revive the discussion.

A pseudo-element might still be a possible solution for several use cases. Though the use case you outlined for making background colors transparent is already solved via the relative color syntax. And background _image_ transparency (and much more) can be achieved with what I mentioned.

The main point why I am against introducing a `background-opacity` property is its very restricted use case. Note that there were also suggestions for a [`background-filter`](https://github.com/w3c/csswg-drafts/issues/4706) property, a [`background-rotate`](https://github.com/w3c/csswg-drafts/issues/3183) property and a [`background-transform`](https://github.com/w3c/csswg-drafts/issues/2364) property in the past. All solve a very specific use case for backgrounds. People might then ask for the same capabilities for border images or masks. Adding new properties for each of them would just be overkill.

Approaches that introduce new value syntaxes like the relative color syntax or the image manipulation syntax are far more flexible and cover much more use cases. That comes with the cost of having to write a bit more.

Sebastian

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


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

Received on Saturday, 18 February 2023 23:31:35 UTC