Skip to content

RGB values incompatible between RGB2HSL and HSL2RGB #2

@gianlucabertani

Description

@gianlucabertani

Hello,

thanks for this useful header file.

Using it I've noticed the RGB2HSL function expects RGB values between 0 and 255, while the HSL2RGB returns RGB values between 0 and 1. Thus, if you take an RGB color, convert it to HSL and back to RGB, the result is not the original color.

Just deleting the first 3 lines of RGB2HSL (or alternatively adding a multiplication by 255 at the end of HSL2RGB) fixes the issue.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions