MCPcopy Create free account
hub / github.com/freecodexyz/free-code / hexComponent

Function hexComponent

src/utils/systemTheme.ts:97–100  ·  view source on GitHub ↗

Normalize a 1–4 digit hex component to [0, 1].

(hex: string)

Source from the content-addressed store, hash-verified

95
96/** Normalize a 1–4 digit hex component to [0, 1]. */
97function hexComponent(hex: string): number {
98 const max = 16 ** hex.length - 1
99 return parseInt(hex, 16) / max
100}
101
102/**
103 * Read $COLORFGBG for a synchronous initial guess before the OSC 11

Callers 1

parseOscRgbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected