This seems like such a simple problem, exactly what colormath
was designed for. But calling convert_color
appears to return the same object that was passed in. According to the documentation a failed conversion should raise a UndefinedConversionError
, not return an object.
>>> from colormath.color_objects import sRGBColor, AdobeRGBColor
>>> from colormath.color_conversions import convert_color
>>> srgb = sRGBColor(0.0, 1.0, 0.0)
>>> srgb
sRGBColor(rgb_r=0.0,rgb_g=1.0,rgb_b=0.0)
>>> argb = convert_color(srgb, AdobeRGBColor)
>>> argb
sRGBColor(rgb_r=0.0,rgb_g=1.0,rgb_b=0.0)
>>> argb is srgb
True
It does work to convert to Lab
so I'm unsure what the problem could be.
>>> from colormath.color_objects import LabColor
>>> convert_color(srgb, LabColor)
LabColor(lab_l=87.73500278716472,lab_a=-86.1829494051608,lab_b=83.1795364492565)