Open gapipro opened 10 years ago
Great. Could you please create a pull request? I'm not sure about the simplification though. Compare:
If hsv.h
is 350
, then h = (350 % 360) / 60 = 5.833
and therefore (h % 2) = (5.833 % 2) = 1.833
but (1 - Math.abs(h % 2 - 1)) = (1 - Math.abs(5.833 % 2 - 1)) = 0.1669
which is not the same as 1.833
.
Yes, I noticed that too. It would work if h was round number.
Implementation of hsv2rgb function is incorrect.
If you convert color: #81c111 from hex to hsv and then back to hex you will get: #80c110
Problem is with decimal rounding. Here is my fixed version: