Closed alex-knyaz closed 5 years ago
Your diagnosis is correct, wonderful catch.
I tested this with the "official" implementation (the creator of the model has sadly abandoned the project - which is sad, because I actually really like this model) and your math is correct.
> hcg = require('./hcg')
{ rgb2hcg: [Function: rgb2hcg], hcg2rgb: [Function: hcg2rgb] }
> hcg.rgb2hcg([250, 0, 255])
[ 0.8300653594771242, 255, 0 ]
> 0.8300653594771242 * 360
298.8235294117647
Pushing a patch now.
Published as 2.0.1
. Thanks again for a well-written bug report - highly appreciated.
Steps to reproduce
Here we are converting from RGB to HCG and then back. Note color components are very far apart.
Description
Then converting color to HCG from RGB or CMYK Hue component of the color appears to be offset by 120°.
Current behavior
Expected behavior
Cause?
https://github.com/Qix-/color-convert/blob/master/conversions.js#L668
4 is added twice. This is most likely it, but I'm not 100% sure.