Skip to content

LCH hue doesn't round-trip #316

@marcinwrochna

Description

@marcinwrochna

Hi! I'm trying to extract the LCH hue from a color, but the values I get are off. Am I missing something?

const hue = 200.0;
const newHue = ColorTranslator.toLCHObject(`lch(50% 50% ${hue})`).H;
const degHue = ColorTranslator.toLCHObject(`lch(50% 50% ${hue}deg)`, { anglesUnit: "deg" }).H;
console.log(hue, newHue, degHue);

const newHue = ColorTranslator.toLCHObject(`lch(50% 100% ${hue})`).H;
const degHue = ColorTranslator.toLCHObject(`lch(50% 100% ${hue}deg)`, { anglesUnit: "deg" }).H;
console.log(hue, newHue, degHue);

colortranslator v5.0.0 prints 200 210.769587 210.769587 and 200 235.818193 235.818193.

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