MCPcopy Index your code
hub / github.com/microsoft/SandDance / hclConvert

Function hclConvert

docs/app/js/sanddance-app.js:128094–128100  ·  view source on GitHub ↗
(o)

Source from the content-addressed store, hash-verified

128092 return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
128093}
128094function hclConvert(o) {
128095 if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
128096 if (!(o instanceof Lab)) o = labConvert(o);
128097 if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
128098 var h = Math.atan2(o.b, o.a) * (0, _mathJs.degrees);
128099 return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
128100}
128101function lch(l, c, h, opacity) {
128102 return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
128103}

Callers 2

lchFunction · 0.70
hclFunction · 0.70

Calls 1

labConvertFunction · 0.70

Tested by

no test coverage detected