chroma icon indicating copy to clipboard operation
chroma copied to clipboard

fix: hex8 to rgba

Open rkotov93 opened this issue 3 years ago • 2 comments

Problem

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

Screenshot 2021-04-12 at 17 04 43 Screenshot 2021-04-12 at 19 21 22

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 years old issue https://github.com/jfairbank/chroma/issues/6, that was resolved by replacing the order of arguments for FromHexStringValues#from_hex8 method. I have moved it back and now it returns expected RGB:

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

rkotov93 avatar Apr 12 '21 17:04 rkotov93

Hey @jfairbank, is there any chance it will be merged?

rkotov93 avatar May 20 '21 12:05 rkotov93

@rkotov93 FYI I've created a fork/rename of Chroma that I intend to maintain and I've fixed this issue with commit https://github.com/evanleck/kodachroma/commit/b7df42998166dddd7df76d04598d87f70540349e

evanleck avatar Sep 13 '21 20:09 evanleck