Skip to content

[css-color-5] Behavior of none in relative color syntax #10151

Closed
@romainmenke

Description

@romainmenke

see : https://drafts.csswg.org/css-color-4/#valdef-color-none

For all other purposes, a missing component behaves as a zero value, in the appropriate unit for that component: 0, 0%, or 0deg. This includes rendering the color directly, converting it to another color space, performing computations on the color component values, etc.

There is a note still in the WPT tests for relative color about none :

https://github.com/web-platform-tests/wpt/blob/master/css/css-color/parsing/color-computed-relative-color.html#L336-L340

  // FIXME: Clarify with spec editors if 'none' should pass through to the constants.
  fuzzy_test_computed_color(`lab(from lab(none none none) l a b)`, `lab(0 0 0)`);
  fuzzy_test_computed_color(`lab(from lab(none none none / none) l a b / alpha)`, `lab(0 0 0 / 0)`);
  fuzzy_test_computed_color(`lab(from lab(25 none 50) l a b)`, `lab(25 0 50)`);
  fuzzy_test_computed_color(`lab(from lab(25 20 50 / none) l a b / alpha)`, `lab(25 20 50 / 0)`);

As I understand it there are two possible cases:

  • none was used in the origin color (e.g. hsl(from hsl(none 50% 50%) h s l))
  • none was used in the relative color (e.g. hsl(from green none s l))

When none was used in the origin color then it should be treated as 0 because channel keywords have type number.

When none was used in the relative color then it should behave exactly the same as it does in absolute colors.

Is this correct?

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Wednesday morning

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions