Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[color-4] Clarification of missing color components and parsing #8362

Closed
tiaanl opened this issue Jan 26, 2023 · 5 comments
Closed

[color-4] Clarification of missing color components and parsing #8362

tiaanl opened this issue Jan 26, 2023 · 5 comments

Comments

@tiaanl
Copy link
Contributor

tiaanl commented Jan 26, 2023

In reference to this section in the [color-4] specification:

In certain cases,

According to what is mentioned here, I am uncertain whether missing color components should parse to a valid or invalid color. Currently the following are all valid colors:

color(srgb)  // 0, 0, 0
color(srgb 1)  // 1, 0, 0
color(srgb 1 1)  // 1, 1, 0
color(srgb 1 1 1)  // 1, 1, 1

There is also a definition of the color syntax here (https://w3c.github.io/csswg-drafts/css-color-4/#color-function):

<predefined-rgb-params> = <predefined-rgb> [ <number> | <percentage> | none ]{3}

which does not allow any missing components, but does indeed accept the 'none' keyword.

Does this rule make the previously mentioned valid color invalid if they do not have the 'none' keyword in place of the missing components?

color(srgb none none none)  // 0, 0, 0
color(srgb 1 none none)  // 1, 0, 0
color(srgb 1 1 none)  // 1, 1, 0
color(srgb 1 1 1)  // 1, 1, 1
@emilio
Copy link
Collaborator

emilio commented Jan 26, 2023

Pretty sure the fact that these parse in WebKit / Blink is a bug. It's super-odd and not particularly useful either. Also, the syntax is rather clear :)

In fact I filed this as https://bugs.webkit.org/show_bug.cgi?id=251152 / https://bugs.chromium.org/p/chromium/issues/detail?id=1410200. But it's probably worth clarifying, @svgeesus / @LeaVerou?

@svgeesus svgeesus added the css-color-4 Current Work label Jan 26, 2023
@svgeesus
Copy link
Contributor

Like @emilio I thought the spec was clear but taking another look just now, I see:

One or more s or s providing the parameter values that the color space takes.

This is left over from when we used to auto fill-in omitted values and trim excess values. Which we decided not to do anymore, once color() in CSS Color 4 was restricted to predefined RGB spaces, and we dropped fallback colors.

The grammar itself is clear:

{3}

So I need to clean up that old text to make it once more agree with the grammar.

@svgeesus
Copy link
Contributor

Spec now says

The three parameter values that the color space takes (RGB or XYZ values).

to agree with the grammar.

@svgeesus
Copy link
Contributor

Also, I now see from this issue that the phrase 'missing color component' can be mis-interpreted to mean an author-omitted value, not a powerless component.

@svgeesus
Copy link
Contributor

@emilio wrote:

Pretty sure the fact that these parse in WebKit / Blink is a bug. It's super-odd and not particularly useful either.

This is leftover (previously correct) behavior from when color() accepted a variable-length list of color components. I agree it is now a bug.

moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 30, 2023
According to the specification, missing components in the color function
should result in an invalid color.  This patch removes those tests from
valid checks and adds them to the invalid checks.

https://w3c.github.io/csswg-drafts/css-color-4/#missing

Clarification from the csswg github repo:
w3c/csswg-drafts#8362

Differential Revision: https://phabricator.services.mozilla.com/D167946

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1812548
gecko-commit: 279c04f1ec0406ef91adbc3ef59a7eb0127e5be4
gecko-reviewers: emilio
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jan 31, 2023
According to the specification, missing components in the color function
should result in an invalid color.  This patch removes those tests from
valid checks and adds them to the invalid checks.

https://w3c.github.io/csswg-drafts/css-color-4/#missing

Clarification from the csswg github repo:
w3c/csswg-drafts#8362

Differential Revision: https://phabricator.services.mozilla.com/D167946
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 31, 2023
According to the specification, missing components in the color function
should result in an invalid color.  This patch removes those tests from
valid checks and adds them to the invalid checks.

https://w3c.github.io/csswg-drafts/css-color-4/#missing

Clarification from the csswg github repo:
w3c/csswg-drafts#8362

Differential Revision: https://phabricator.services.mozilla.com/D167946

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1812548
gecko-commit: 279c04f1ec0406ef91adbc3ef59a7eb0127e5be4
gecko-reviewers: emilio
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Jan 31, 2023
According to the specification, missing components in the color function
should result in an invalid color.  This patch removes those tests from
valid checks and adds them to the invalid checks.

https://w3c.github.io/csswg-drafts/css-color-4/#missing

Clarification from the csswg github repo:
w3c/csswg-drafts#8362

Differential Revision: https://phabricator.services.mozilla.com/D167946
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this issue Mar 28, 2023
According to the specification, missing components in the color function
should result in an invalid color.  This patch removes those tests from
valid checks and adds them to the invalid checks.

https://w3c.github.io/csswg-drafts/css-color-4/#missing

Clarification from the csswg github repo:
w3c/csswg-drafts#8362

Differential Revision: https://phabricator.services.mozilla.com/D167946

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1812548
gecko-commit: 279c04f1ec0406ef91adbc3ef59a7eb0127e5be4
gecko-reviewers: emilio
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this issue Jun 1, 2024
According to the specification, missing components in the color function
should result in an invalid color.  This patch removes those tests from
valid checks and adds them to the invalid checks.

https://w3c.github.io/csswg-drafts/css-color-4/#missing

Clarification from the csswg github repo:
w3c/csswg-drafts#8362

Differential Revision: https://phabricator.services.mozilla.com/D167946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants