Open ty8447 opened 2 years ago
I can confirm. RGB values seems to be too heavy on the blue side.
Let me take a look on that. Thanks to comments.
@DjamesSuhanko The problem is that your math to convert from HSV to RGB is incorrect. I changed it in the code on here and submitted for approval way back in November or something.
@DjamesSuhanko I guess that I make a fork of this to fix the issue. Check it out here and see the change I made https://github.com/ty8447/EasyColor.
@ty8447 I will test soon. Hoping it helps!
The problem is in EasyColor.cpp line 41 :
float x = c * (1 - fabsf (fmod ((in.h / HUE_ANGLE), 2) - 1));
HUE_ANGLE is defined as 360, but for this function it should be 60. So the correct line should be:
float x = c * (1 - fabsf (fmod ((in.h / 60), 2) - 1));
When converting from RGB to HSV, the values are calculated correctly, but when taking those numbers and plugging it back to convert to RGB the values are incorrect.