Skip to content

[css-color] Clarification needed on how missing alpha components flow through relative color syntax for hsl/hwb #10254

Open
@weinig

Description

@weinig

In the WPT test, css/css-color/parsing/color-computed-relative-color.html, there are a few examples I don't quite understand and can't figure out which language in the spec dictate them.

One is:

fuzzy_test_computed_color(`hsl(from rebeccapurple none none none / none)`, `color(srgb 0 0 0 / none)`)

What allows the alpha value to be passed through as none?

My understand here of the operations performed is:

  1. rebeccapurple converted to hsl() [hsl(270 50% 40%)]
  2. Relative color is resolved via channel arguments to hsl(none none none / none)
  3. hsl(none none none / none) is converted to color(srgb) for serialization, resolving all missing components to 0 [color(srgb 0 0 0 / 0)] (https://drafts.csswg.org/css-color-5/#serial-relative-color)

Is the intention for that last conversion (from hsl() to color(srgb)) to carry forward analogous component missing values?

Somewhat perplexingly (and perhaps just an error in the test), the corresponding test css/css-color/parsing/color-valid-relative-color has a similar example.

fuzzy_test_valid_color(`${hslFunction}(from rebeccapurple none none none / none)`, `color(srgb 0 0 0 / 0)`);

My expectation is that they should at least expect the same result.

Similarly, what would expect for missing components in the origin.

color: hsl(from hsl(none none none / none) h s l / alpha);
color: hsl(from hsl(none none none / none) h s l);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Wednesday morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions