MCPcopy Index your code
hub / github.com/codeaashu/claude-code / hueToRgb

Function hueToRgb

src/components/Spinner/utils.ts:32–66  ·  view source on GitHub ↗
(hue: number)

Source from the content-addressed store, hash-verified

30
31// HSL hue (0-360) to RGB, using voice-mode waveform parameters (s=0.7, l=0.6).
32export function hueToRgb(hue: number): RGBColorType {
33 const h = ((hue % 360) + 360) % 360
34 const s = 0.7
35 const l = 0.6
36 const c = (1 - Math.abs(2 * l - 1)) * s
37 const x = c * (1 - Math.abs(((h / 60) % 2) - 1))
38 const m = l - c / 2
39 let r = 0
40 let g = 0
41 let b = 0
42 if (h < 60) {
43 r = c
44 g = x
45 } else if (h < 120) {
46 r = x
47 g = c
48 } else if (h < 180) {
49 g = c
50 b = x
51 } else if (h < 240) {
52 g = x
53 b = c
54 } else if (h < 300) {
55 r = x
56 b = c
57 } else {
58 r = c
59 b = x
60 }
61 return {
62 r: Math.round((r + m) * 255),
63 g: Math.round((g + m) * 255),
64 b: Math.round((b + m) * 255),
65 }
66}
67
68const RGB_CACHE = new Map<string, RGBColorType | null>()
69

Callers 2

TextInputFunction · 0.85
AnimatedAsteriskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected