jsdom / cssstyle

A Node.js implementation of the CSS Object Model CSSStyleDeclaration interface
MIT License
107 stars 70 forks source link

Fails to parse "modern rgb syntax" and some other valid colors #174

Open sbj42 opened 3 months ago

sbj42 commented 3 months ago

A color in "legacy rgb syntax" with no alpha (e.g. rgb(255, 255, 255)) appears to be properly handled by parseColor. However there are other valid color formats that are not handled.

See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#formal_syntax

The following valid CSS colors are not parsed properly by parseColor:

Note all of those should also work with rgba(), as it has the same syntax as rgb() - e.g. the alpha value is optional in both.