Search code examples
pythonnumpycolorsrgbhsl

why the r in rgb value is not correct when converting rgb to hsl in colorsys package


import colorsys
print(colorsys.rgb_to_hls(92/255, 137/255, 78/255))

[0.29378531 0.42156863 0.2744186]

Saturation (S),Lightness (L) is correct(according this website), but Hue should 106, I am not sure where is problem?


Solution

  • The output of colorsys.rgb_to_hls is expressed in parts per unit (between 0 and 1):

    106/360=0.294
    

    You can see the permitted values of the functions of colorsys in the following picture:

    enter image description here