Skip to content

Fix CSS color parsing for exponent channels and hue units - #1186

Open
sogav21 wants to merge 1 commit into
ecomfe:masterfrom
sogav21:fix/1184-css-color-parsing
Open

sogav21 wants to merge 1 commit into
ecomfe:masterfrom
sogav21:fix/1184-css-color-parsing

Conversation

@sogav21

@sogav21 sogav21 commented Nov 17, 2026

Copy link
Copy Markdown

Comma-separated colors can lose RGB exponents, interpret HSL angles as degrees, or return
a NaN alpha for a trailing comma in rgb(). This change evaluates exponent-form RGB
channels, normalizes turn, rad, and grad hues, adds rebeccapurple, and rejects
a blank fourth rgb() argument before writing the output array.

All six issue examples and 13 compatibility controls passed against the built library.
The Jest suite passed 82 tests, including signed exponents, negative hue wrapping,
case-insensitive syntax, and output-array/cache behavior. Library build, type check, and
lint passed on Node 22.23.1.

Prepared with OpenAI Codex assistance.

Fixes #1184

This branch has not been deployed

No deployments
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.

color.parse returns wrong colors for exponent numbers and hue units, and lacks rebeccapurple

1 participant