MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / mix

Function mix

packages/frontend/src/ui/color.ts:23–40  ·  view source on GitHub ↗
(a: HSL, b: HSL, ar: number, br: number)

Source from the content-addressed store, hash-verified

21}
22
23export function mix(a: HSL, b: HSL, ar: number, br: number): HSL {
24 let sum = ar + br
25 ar = ar/sum
26 br = br/sum
27 let ah = a[0], bh = b[0]
28 if (Math.abs(ah - bh) > 180) {
29 if (ah > bh) {
30 bh += 360
31 } else {
32 ah += 360
33 }
34 }
35 let c = hsl_zero()
36 c[0] = (ah*ar + bh*br + 360) % 360
37 c[1] = a[1]*ar + b[1]*br
38 c[2] = a[2]*ar + b[2]*br
39 return c
40}
41
42/** Represents a color in the RGB color space. */
43export class RGB {

Callers

nothing calls this directly

Calls 1

hsl_zeroFunction · 0.85

Tested by

no test coverage detected