Open Shadercloud opened 2 years ago
After more playing around I've found I need to be dividing my HSL values, but I'm still getting weird results; when compare to colorsys
conversion (where I get the correct result).
For example:
from colormath.color_conversions import convert_color
import colorsys
from colormath.color_objects import LabColor, HSLColor, sRGBColor
h = 89
s = 19
l = 90
color = HSLColor(h/360, s/100, l/100)
lab1 = convert_color(color, LabColor)
print(lab1)
r, g, b = colorsys.hls_to_rgb(h/360, l/100, s/100)
lab2 = convert_color(sRGBColor(r, g, b), LabColor)
print(r, g, b)
print(lab2)
Output is:
LabColor (lab_l:90.1623 lab_a:3.2667 lab_b:1.1810)
0.9006333333333334 0.919 0.881
LabColor (lab_l:92.2324 lab_a:-3.2794 lab_b:4.1440)
So when converting through colorsys.hls_to_rgb
first then i get a correct output, but just using only convert_color
I do not.
I've tried using through_rgb_type=sRGBColor
but still does not give correct results.
If I try to convert from HSL I get some weird outputs:
For example:
Output looks like this:
As you can see this is obviously wrong, and when I use a tool such as this: http://colormine.org/color-converter I get results of: