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

Function parseHsva

src/colorModels/hsv.ts:19–30  ·  view source on GitHub ↗
({ h, s, v, a = 1 }: InputObject)

Source from the content-addressed store, hash-verified

17});
18
19export const parseHsva = ({ h, s, v, a = 1 }: InputObject): RgbaColor | null => {
20 if (!isPresent(h) || !isPresent(s) || !isPresent(v)) return null;
21
22 const hsva = clampHsva({
23 h: Number(h),
24 s: Number(s),
25 v: Number(v),
26 a: Number(a),
27 });
28
29 return hsvaToRgba(hsva);
30};
31
32export const rgbaToHsva = ({ r, g, b, a }: RgbaColor): HsvaColor => {
33 const max = Math.max(r, g, b);

Callers

nothing calls this directly

Calls 3

isPresentFunction · 0.90
clampHsvaFunction · 0.85
hsvaToRgbaFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…