Qix-/color-convert

Incorrect conversion RGB to HSV #98

Elugormo posted onGitHub

When converting from RGB to HSV precision plays a big role. So when rounding some of the numbers, we don't convert the right color. The example is clear when converting the #f6f6f6 color to HSV. According to the internet resources we get: image To be more clear color will be - 0, 0, 96.47. As this library performs rounding on the end, it rounds it to 0, 0, 96, which is incorrect, because the RGB representation of this color will be #f5f5f5. I went through the source code, and found out, that we perform rounding on all models, but in some cases, it can cause serious difficulties because of this rounding bug. Maybe we should round to 1 decimal place instead?


From the readme:

To get the unrounded (raw) results, simply tack on .raw to the function.

posted by Qix- almost 3 years ago

Fund this Issue

$0.00
Funded

Pull requests