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

Colors are not interpreted correctly #48

Closed
SidneyNemzer opened this issue Jan 20, 2017 · 3 comments · Fixed by #74
Closed

Colors are not interpreted correctly #48

SidneyNemzer opened this issue Jan 20, 2017 · 3 comments · Fixed by #74

Comments

@SidneyNemzer
Copy link

SidneyNemzer commented Jan 20, 2017

Keywords
CSS has hundreds of color keywords, but CSSStyle only recognizes a few
https://github.com/chad3814/CSSStyleDeclaration/blob/master/lib/parsers.js#L100-L116

HSL and HSLA
CSSStyle has no logic to interpret HSL or HSLA values. Here's the regex for Hex, RGA, and RGBA. HSL and HSLA are missing.

https://github.com/chad3814/CSSStyleDeclaration/blob/master/lib/parsers.js#L28-L30

Computing the result
Hex values are correctly converted to RGB, however keywords (even valid ones) are not. If CSSStyle intends to emulate a browser's behavior, it should convert everything to RGB or RGBA

TLDR
CSSStyle doesn't handle color values correctly

@SidneyNemzer SidneyNemzer changed the title Colors are not correctly interpreted Colors are not interpreted correctly Jan 26, 2017
@FagnerMartinsBrack
Copy link

This is causing an issue with JSDOM.

@PavelPZ
Copy link

PavelPZ commented Nov 2, 2018

... and all its dependencies, as JEST, REACT-TESTING-LIBRARY etc.
Is PR welcomed? Can I fix parsers.js?

@bennypowers
Copy link
Contributor

This breaks lighthouse tests:

screenshot 2019-02-02 22 01 08

screenshot 2019-02-02 22 00 57

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 a pull request may close this issue.

4 participants