10BC0 GitHub Β· Where software is built
[go: up one dir, main page]

Skip to content

[css-color] [css-color-adjust] Make system colors fully resolve (but flag they were system colors) thus reversing the resolution of #3847Β #6773

@emilio

Description

@emilio

In #3847 it was resolved that system colors would compute to themselves. The argument for that seems sensible (which is that color-scheme would be automatically honored for them while inheriting).

However I'm not so sure that's great behavior (plus there are still open issues from that change like #5780).

In particular, in order to guarantee contrast, you need to use system color pairs (the foreground and the background), such as:

div {
  background-color: Canvas;
  color: CanvasText;
}

If color-scheme changes, but the author doesn't specify a background, making system colors compute to themselves at computed-value time breaks contrast (rendered):

<!doctype html>
<style>
  :root { color-scheme: dark }
  span { color-scheme: light }
</style>
I'm dark, and <span>I'm light</span>

The span should be dark text over dark background per spec, since it inherits the initial color which is canvastext, which is undesirable.

That's clearly not how browsers are working today, which confuses me because I thought Chrome implemented this change.

I'd expect this test-case to render per spec the same as the following (rendered):

<!doctype html>
<style>
  :root { color-scheme: dark }
  span { color-scheme: light; color: CanvasText }
</style>
I'm dark, and <span>I'm light</span>

(which is clearly undesirable, and not what's going on).

Can you explain what's going on here @Futhark / @andruud / @kbabbitt / @tabatkins?

cc @smfr

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