Antonio-Laguna / jQuery-ColorPicker

This is yet another colorpicker plugin for jQuery since most of them are not on GitHub nor being mantained at the moment.
Other
91 stars 22 forks source link

HSBToRGB method issue #9

Open sean-zou opened 11 years ago

sean-zou commented 11 years ago

HSBToRGB method use rounded hsb value to calculate the rgb value, sometimes it changes the user input rgb values, it does not look right from a user perspective.

For example, enter R 0 G 255 B 63, then it will change B to 64.

proposed fix is to remove the round call on hsb values.

timotta commented 11 years ago

I had the same problem, the color #e73e2c is rounded to #e73f2c

Since the function HSBToRGB already round the numbers in the end, we do not need the round in the start:

    //var h = Math.round(hsb.h);
    //var s = Math.round(hsb.s*255/100);
    //var v = Math.round(hsb.b*255/100);
    var h = hsb.h;
    var s = hsb.s*255/100;
    var v = hsb.b*255/100; 

It solved the problem