Skip to content

[css-color-5] Serialization of rgb() and hsl() origin colors conflicts with WPT #14951

Backlog

Description

@svgeesus

Serializing Origin Colors and the WPT test css/css-color/parsing/color-valid-relative-color.html disagree on how an rgb() or hsl() origin color serializes in a declared value.

The spec says to keep the function (rgb or hsl), with space-separated components as specified, percentages staying percentages, and no clamping. This came from #10328.

The test expects the origin color to be resolved to sRGB and serialized as for a top-level color:

Origin color as authored Spec WPT expects
rgb(20%, 40%, 60%, 80%) rgb(20% 40% 60% / 80%) rgba(51, 102, 153, 0.8)
hsl(120deg 20% 50% / .5) hsl(120deg 20% 50% / 0.5) rgba(102, 153, 102, 0.5)
rgb(20% none 60%) rgb(20% none 60%) color(srgb 0.2 none 0.6)

For example, for rgb(from rgb(20% none 60%) r g b) the test expects rgb(from color(srgb 0.2 none 0.6) r g b).

The expected values in the test match the CSS Color 4 serialization of sRGB values. I have not checked what implementations currently do.

Which is correct? The answer also affects:

Activity

  1. added
    css-color-5
    spec-test-mismatch
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    css-color-5spec-test-mismatch

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions