Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-color] Is relative color syntax ready to ship? #7978

Closed
nt1m opened this issue Oct 29, 2022 · 11 comments
Closed

[css-color] Is relative color syntax ready to ship? #7978

nt1m opened this issue Oct 29, 2022 · 11 comments

Comments

@nt1m
Copy link
Member

nt1m commented Oct 29, 2022

https://www.w3.org/TR/css-color-5/#relative-colors

https://www.w3.org/TR/css-color-5/#serial-relative-color

This came up as an Interop 2023 proposal, and there is an implementation in WebKit, and we were wondering if this is ready to ship?

cc @svgeesus @emilio @lilles

@emilio
Copy link
Collaborator

emilio commented Nov 3, 2022

@nt1m how does the WebKit implementation (and what does the spec say) about currentColor and similar usual-suspects?

@gsnedders
Copy link
Contributor

See also #7310 (comment)

Re-opening since we dropped the ball on Relative Color Syntax. Jen asked about RCS in the initial post in this issue; there was a brief discussion on May 25 but nothing was decided as none of the editors were on the call.

Interop2022 is considering dropping it because of lack of signals from CSSWG.

And the following comment:

There wasn't a resolution that it was not ready. Nor was there a resolution that it was ready. I re-opened the issue because the question you asked didn't really get much discussion nor a clear resolution. There was a passing mention by @emilio that there was only one implementation (in WebKit) and they "would like more feedback on relative color syntax".

(Both @svgeesus)

@nt1m
Copy link
Member Author

nt1m commented Nov 10, 2022

@nt1m how does the WebKit implementation (and what does the spec say) about currentColor and similar usual-suspects?

I think we'll end up matching what color-mix() will be doing (cc @mdubet who will be working on fixing that)

@svgeesus
Copy link
Contributor

Yes, matching color-mix() seems the way forward.

@yairEO
Copy link

yairEO commented Nov 15, 2022

And for the sake of the record, for me who has no idea what color-mix() has implemented, what exactly should happen with currentColor & relative-color?

(I came here investigating especially this use-case)

@svgeesus
Copy link
Contributor

svgeesus commented Nov 15, 2022

@yairEO from Serializing Relative Color Functions :

The serialization of the result of a relative color function is a , as defined in CSS Color 4 § 15 Serializing Values. The form used is the same as that used to specify the relative color, but using the absolute form.

So the result of a color-mix() between currentColor and RCS is the same exactly as a mix between currentColor and any other absolute color.

Or did you mean an RCS where the origin color is currentColor?

@yairEO
Copy link

yairEO commented Nov 15, 2022

My question is this use-case:

div{ color:red; background:rgb(from currentColor r g b / 50%); }

@svgeesus
Copy link
Contributor

Yeah that would serialize as specified; it can't fully resolve because the value of the color property could be different on child elements or child pseudo-elements.

@svgeesus
Copy link
Contributor

svgeesus commented Jan 11, 2023

This needs explicit spec text for resolving the RCS value when currentColor is the origin , saying that the RCS serializes as specified so that child elements are handled correctly. There is already similar text in Resolving color-mix() Valuesfor resolving color-mix() so as noted by @nt1m we should re-use that:

If all parameters resolve to the corresponding colors in their respective color spaces, the computed value is the mixed color, in the specified mixing color space, resolved according to CSS Color 4 § 14 Resolving Values. Otherwise (if currentColor was used in the function), the computed value is the color-mix() function with each parameter resolved according to CSS Color 4 § 14 Resolving Values, thus preserving inheritance into child elements.

@svgeesus
Copy link
Contributor

@nt1m @emilio I added the specific text, does this look good to you and are there any other blockers for shipping RCS?

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed Relative Color Syntax, and agreed to the following:

  • RESOLVED: Accept Chris's proposal
The full IRC log of that discussion <fantasai> Topic: Relative Color Syntax
<fantasai> github: https://github.com//issues/7978
<fantasai> chris: problem was using base color as ??
<fantasai> chris: I added spec text similar to color-mix()
<fantasai> chris: if that's okay by everyone we have solved the issue
<fantasai> TabAtkins: Great for me
<fantasai> Rossen_: Anyone else?
<TabAtkins> s/using base color as ??/specifying base color as currentcolor/
<fantasai> RESOLVED: Accept Chris's proposal
<lea> +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants