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-4] Clarify used value of currentColor #10352

Open
matthiasclasen opened this issue May 18, 2024 · 3 comments
Open

[css-color-4] Clarify used value of currentColor #10352

matthiasclasen opened this issue May 18, 2024 · 3 comments
Labels
css-color-4 Current Work

Comments

@matthiasclasen
Copy link

matthiasclasen commented May 18, 2024

In css-color-4, we learn

  1. "currentColor computes to itself"
  2. "inside the color property, the used value of current color is its inherited value"

In css-cascade-5, we learn

  1. "the inherited value of a property is the computed value of the parent"

So if I have

<div style="color: currentColor">
     <div style="color: curentColor">
       ...

Then the styles of both divs have a computed color property of currentColor by 1.

Now, if I want to find out what color to use for the second div, I consult 2. to learn that
the I need to use the inherited value of the color property, which, by 3., is the computed
value of the color property on the parent element. And we've already seen that that is currentColor.

How do I draw with currentColor ?

I believe that browsers don't implement 3. properly and inherit the used value of the color property instead.

The question gets more entertaining when currentColor is inside expressions with color-mix or other color functions.

@matthiasclasen matthiasclasen changed the title [css-color-4] Clarify used value of currentColor [css-color-5] Clarify used value of currentColor May 18, 2024
@matthiasclasen matthiasclasen changed the title [css-color-5] Clarify used value of currentColor [css-color-4] Clarify used value of currentColor May 18, 2024
@Loirooriol
Copy link
Contributor

I guess instead of the raw inherited value, it should be the resolved inherited value.

@Loirooriol Loirooriol added the css-color-4 Current Work label May 21, 2024
@matthiasclasen
Copy link
Author

Whats a resolved inherited value, other than a used value?

I don't see that concept defined here: https://www.w3.org/TR/CSS22/cascade.html

@Loirooriol
Copy link
Contributor

Loirooriol commented May 21, 2024

Yeah I meant resolving the inherited value into a used color (https://drafts.csswg.org/css-color/#resolving-color-values)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-color-4 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants