Skip to content

possible rounding error when converting hsl to hex #1909

@matovas

Description

@matovas

Sass automaticaly converted hsl to #hex colors.
Some times this process has small bug.

// styles.scss
$pink_5l: hsl(340, 80%, 95%);
body { background-color: $pink_5l; }

// styles.css
body { background-color: #fce8ef; }

All good, but hsl(340, 80%, 95%) ≠ #fce8ef,
because #fce8ef = hsl(339, 77%, 95%)

I testing this, my result
hsl(340, 80%, 95%) — bad converting
hsl(340, 80%, 90%) — good converting
hsl(340, 80%, 80%) — good converting
hsl(340, 80%, 70%) — good converting
hsl(340, 80%, 60%) — good converting
hsl(340, 80%, 50%) — good converting
hsl(340, 80%, 40%) — good converting
hsl(340, 80%, 30%) — good converting
hsl(340, 80%, 20%) — good converting
hsl(340, 80%, 10%) — good converting
hsl(340, 80%, 5%) — bad converting

Thanks!

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