Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Converting from HSL to RGB or LAB gets odd results #114

Open
@Shadercloud

Description

@Shadercloud

If I try to convert from HSL I get some weird outputs:

For example:

from colormath.color_objects import LabColor, HSLColor, sRGBColor

color = HSLColor(89, 19, 90)
rgb = convert_color(color, sRGBColor)
lab = convert_color(color, LabColor)
print(color)
print(rgb)
print(lab)

Output looks like this:

HSLColor (hsl_h:89.0000 hsl_s:19.0000 hsl_l:90.0000)
sRGBColor (rgb_r:33.6333 rgb_g:-1601.0000 rgb_b:1781.0000)
LabColor (lab_l:18430.3065 lab_a:30243.3421 lab_b:-41190.8731)

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:

# results are rounded
L*A*B* = (92.23, -3.27, 4.14)
RGB = (229, 234, 224)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions