8000 [css-color-5] Clarify serialization of color-mix() · Issue #6206 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[css-color-5] Clarify serialization of color-mix() #6206

@weinig

Description

@weinig

In the recently added color-mix() test in WPT, https://github.com/web-platform-tests/wpt/blob/master/css/css-color/color-mix-basic-001.tentative.html, Firefox and WebKit already disagree on the results.

Firefox (and the test, since it was imported from Firefox) is currently serializing the result of a color-mix in srgb as:

color-mix(in srgb, blue, red  50%)  -> rgb(128, 0, 128)

whereas WebKit is serializing it as:

color-mix(in srgb, blue, red  50%)  -> color(srgb 0.5 0 0.5)

I chose the color(srgb ...) syntax serialization for WebKit for two reasons.

  1. The use of srgb as the color space in the color-mix() gave it symmetry.
  2. The use of the color(srgb ...) syntax gives more precision in WebKit, and therefore a mix could be more precise.

Either way, I think this should be clarified in the spec.

(Side note, I have a bunch of tests for color-mix(), color-contrast(), and relative color syntax, but have not proposed them for WPT since the specs were still actively moving targets, but if they would be useful, I would be happy to make a PR for WPT.)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0