MCPcopy
hub / github.com/claude-code-best/claude-code / hueToRgb

Function hueToRgb

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

Source from the content-addressed store, hash-verified

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

Callers 2

TextInputFunction · 0.85
AnimatedAsteriskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected