-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[color-transformers > rgbToHsbl] Fix brightness precision of HSB conversions by increasing from 2 decimal digits to 4 #3621
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
Conversation
|
👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. |
kyledurand
left a comment
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.
👍
|
@alex-page @kyledurand Any thoughts on these two questions before I merge:
|
Could be considered a bug fix but I can't see it as a breaking change. If you need this available in web right away then we could cut a release with just this commit in it. |
Yes I think that would be best, then I can tophat the fix on web staging before bumping there. I'm going to kick off the merge this morning. If you guys can help me cut the release once it's merged, or point me to some docs on the process so I can release it myself, that'd be great. |
|
🎉 Thanks for your contribution to Polaris React! |
…ersions by increasing from 2 decimal digits to 4 (#3621) * increase HSB brightness precision to 4 decimals * use past tense
…ersions by increasing from 2 decimal digits to 4 (#3621) * increase HSB brightness precision to 4 decimals * use past tense
…ersions by increasing from 2 decimal digits to 4 (#3621) * increase HSB brightness precision to 4 decimals * use past tense
WHY are these changes introduced?
I was originally investigating this issue in Shopify web https://github.com/Shopify/shopify/issues/265949
and found that the color-transformers on Polaris would convert both hex values
#888888and#878787to the same HSB value{ hue: 0, saturation: 0, brightness: 0.53 }. The calculating actually looked correct,#888888was being converted to0.5333and#878787was being converted to0.5294. But the final step of the conversion limits these to only two decimal places, which resulted in the brightness values being rounded to0.53in both cases and losing their precision.The Shopify Web ticket has more details on the original issue.
WHAT is this pull request doing?
This PR fixes the
color-transformersissue by increasing the brightness value's precision from 2 decimal points to 4.It also adds two tests for the failing conversions from the Shopify web issue for
rgb(135, 135, 135)andrgb(136, 136, 136)to ensure they're both translated to the correct expected values.Questions for reviewers
🎩 checklist
Updated the component's(Didn't see any README for utilities)README.mdwith documentation changes