I have code that converts RGB values to HSL values as well as HSL to RGB. It works fine, however, I have a color picker that can work in either rgb or hsl. The problem is, that they both use integer values..
So if I convert RGB to HSL, I get fractions that need to be rounded. When I convert back to RGB, the values aren't the same as they were- a number is usually of by one (a value of 123 might become 124 after going RGB>HSL>RGB).
I find this odd because in Photoshop, they have the same color picker- you can choose between RGB and HSB, and when you convert back and forth, the RGB values remain consistent and they use integer values when you pick in both modes. How do they accomplish that?