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

fix: hex8 to rgba #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

fix: hex8 to rgba #1

wants to merge 3 commits into from

Conversation

savroff
Copy link

@savroff savroff commented Sep 21, 2022

Problem

Currently Chroma::Color generates a wrong RGB from HEX8. Here is proof that #eb09b9c4 has to be 235, 9, 185:

CleanShot 2022-09-20 at 20 35 28

But Chroma::Color#rgb returns 9, 185, 196:

Chroma::Color.new('#EB09B9C4').rgb
=> #<Chroma::ColorModes::Rgb:0x00007fac8de02a40 @a=0.9215686274509803, @b=196, @g=185, @r=9>

Solution

I have found a six-year-old issue jfairbank#6, that was resolved by replacing the order of arguments for FromHexStringValues#from_hex8 method. I have moved it back, and now it returns the expected RGB:

Chroma::Color.new('#EB09B9C4').rgb
=> #<Chroma::ColorModes::Rgb:0x00007fabb83d8e78 @a=0.7686274509803922, @b=185, @g=9, @r=235>

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.

3 participants