MCPcopy
hub / github.com/omgovich/colord / parseHsla

Function parseHsla

src/colorModels/hsl.ts:20–31  ·  view source on GitHub ↗
({ h, s, l, a = 1 }: InputObject)

Source from the content-addressed store, hash-verified

18});
19
20export const parseHsla = ({ h, s, l, a = 1 }: InputObject): RgbaColor | null => {
21 if (!isPresent(h) || !isPresent(s) || !isPresent(l)) return null;
22
23 const hsla = clampHsla({
24 h: Number(h),
25 s: Number(s),
26 l: Number(l),
27 a: Number(a),
28 });
29
30 return hslaToRgba(hsla);
31};
32
33export const hslaToHsva = ({ h, s, l, a }: HslaColor): HsvaColor => {
34 s *= (l < 50 ? l : 100 - l) / 100;

Callers

nothing calls this directly

Calls 3

isPresentFunction · 0.90
clampHslaFunction · 0.85
hslaToRgbaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…