8000 [css-color-4] Clarify used value of currentColor · Issue #10352 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

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

@matthiasclasen

Description

@matthiasclasen

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0