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
Fix false positives for hex with alpha-channel and false negatives for modern syntax in color-named
#5718
Conversation
@@ -109,6 +109,7 @@ | |||
}, | |||
"dependencies": { | |||
"balanced-match": "^2.0.0", | |||
"colord": "^2.9.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use colord package instead of reference file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The colord
package looks nice to me. Just in case, could you tell us why you choose this package, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* Syntaxes that is removed in Color Module Level 4 specification. */ | ||
|
||
// hwb() with comma | ||
(_colordClass, parsers) => { | ||
parsers.string.push([parseHwbWithCommaString, /** @type {any} */ ('hwb-with-comma')]); | ||
}, | ||
// gray() | ||
(_colordClass, parsers) => { | ||
parsers.string.push([parseGrayString, /** @type {any} */ ('gray')]); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colord
doesn't understand the old syntax, so I extended it.
#RRGGBBAA
in color-named
color-named
color-named
color-named
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ota-meshi Thank you for the great fix PR! 👍🏼
I've left some questions and refactoring suggestions, but this PR looks mostly fine to me! 👏🏼
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
@ybiquitous I have added your requested changes to this PR. So could you check it again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ota-meshi Great work! LGTM 👏🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
This rule was problematically slow in the past.
@ota-meshi It'd be good to get a benchmark of this branch against main
before merging.
I didn't do that intentionally, but it also seems to be of value in terms of performance. After:
Before:
|
The result of |
I fixed this PR. So please check it again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, thank you!
|
Hey guys! Thanks for choosing |
After reading https://github.com/postcss/postcss-color-gray, I am wondering if |
Closes #5716
This PR fixes false positives for alpha-channel posted in #5716, and false negatives for modern syntax (e.g.
rgba(0 0 0 / 1)
).