MCPcopy Create free account
hub / github.com/anomalyco/opencode / toHex

Function toHex

packages/ui/src/theme/color.ts:31–35  ·  view source on GitHub ↗
(v: number)

Source from the content-addressed store, hash-verified

29
30export function rgbToHex(r: number, g: number, b: number): HexColor {
31 const toHex = (v: number) => {
32 const clamped = clamp(v, 0, 1)
33 const int = Math.round(clamped * 255)
34 return int.toString(16).padStart(2, "0")
35 }
36 return `#${toHex(r)}${toHex(g)}${toHex(b)}`
37}
38

Callers 1

rgbToHexFunction · 0.85

Calls 1

clampFunction · 0.70

Tested by

no test coverage detected