Skip to content

Parse the CSS named colors spelled grey - #231

Merged
tomcur merged 1 commit into
linebender:mainfrom
lehni:fix/css-color-grey-and-hsl-whitespace
Oct 21, 2026
Merged

tomcur merged 1 commit into
linebender:mainfrom
lehni:fix/css-color-grey-and-hsl-whitespace

Conversation

@lehni

@lehni lehni commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

CSS Color 4 defines both spellings of the gray names: grey, darkgrey, darkslategrey, dimgrey, lightgrey, lightslategrey and slategrey are valid named colors, the same as their gray versions (§ 6.1). parse_color only knew the gray ones. They're added to make_x11_colors.py, and x11_colors.rs is regenerated.

Found while running the web-platform-tests' canvas colour tests (2d.fillStyle.parse.svg-2) against a canvas built on this crate. With a test.

The hsl() whitespace fix is split out into #232, as asked.

@lehni
lehni force-pushed the fix/css-color-grey-and-hsl-whitespace branch from 56b94b7 to aa7c1de Compare October 20, 2026 07:34
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 20, 2026
…n both syntaxes, hwb(), lab(), lch(), oklab(), oklch(), color()), parsed by the color crate as peniko has it, kept at 8 bits a channel and serialized with alpha in as few decimals as give it back, as browsers do (653 of 1027 WPT tests pass); color pinned to lehni/color for linebender/color#231, the grey names and legacy hsl() whitespace
@lehni
lehni force-pushed the fix/css-color-grey-and-hsl-whitespace branch from aa7c1de to b3d3a7d Compare October 20, 2026 11:11
@waywardmonkeys

Copy link
Copy Markdown
Collaborator

Could you please split these into 2 separate PRs? One here and the other in a new PR? I know we'll have to rebase / amend to deal with the merge conflict in the changelog, so also okay if you stack the second on the first since we can land them in order.

@lehni
lehni force-pushed the fix/css-color-grey-and-hsl-whitespace branch from b3d3a7d to 56b8cef Compare October 21, 2026 10:15
@lehni lehni changed the title Parse the CSS named colors spelled grey, and legacy hsl() with whitespace before its commas Parse the CSS named colors spelled grey Oct 21, 2026
@lehni

lehni commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Done: this PR is now the grey spellings only, and the hsl() whitespace fix is #232, stacked on it.

@tomcur tomcur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good. I think it would be better with the test removed, as it's just restating the code.

@lehni

lehni commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, removed.

@lehni
lehni force-pushed the fix/css-color-grey-and-hsl-whitespace branch from 56b8cef to cc772d7 Compare October 21, 2026 11:16
@tomcur
tomcur added this pull request to the merge queue Oct 21, 2026
Merged via the queue into linebender:main with commit 943c533 Oct 21, 2026
16 checks passed
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 21, 2026
…() in both syntaxes, hwb(), lab(), lch(), oklab(), oklch(), color()), parsed by the color crate as peniko has it, kept at 8 bits a channel and serialized with alpha in as few decimals as give it back, as browsers do (653 of 1027 WPT tests pass); color pinned to lehni/color for linebender/color#231, the grey names and legacy hsl() whitespace
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 21, 2026
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 21, 2026
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 21, 2026
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 21, 2026
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 24, 2026
lehni added a commit to lehni/vectorcraft that referenced this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants