Hi,
i believe that the ChunkyPNG::Color.to_hsl method returns a wrong hue for certain colours.
Example:
require "chunky_png"
irb(main):002:0> ChunkyPNG::Color.to_hsl ChunkyPNG::Color.from_hex("#0A000A")
=> [-60, 1.0000000000000007, 0.0196078431372549]
Afaik the hue should be between 0 and 360 so -60 is wrong. I'd expect to get 300 in this case, which happen to be equal to -60 % 360. So maybe a fix could look like this:
in the ChunkyPNG::Color#hue_and_chroma
hue = hue.between?(0, 360) ? hue : hue % 360
Hi,
i believe that the
ChunkyPNG::Color.to_hslmethod returns a wrong hue for certain colours.Example:
Afaik the hue should be between 0 and 360 so -60 is wrong. I'd expect to get 300 in this case, which happen to be equal to
-60 % 360. So maybe a fix could look like this:in the
ChunkyPNG::Color#hue_and_chroma