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

Function lum

packages/ui/src/theme/resolve.ts:96–100  ·  view source on GitHub ↗
(hex: HexColor)

Source from the content-addressed store, hash-verified

94 const infow = info[isDark ? 5 : 3]
95 const infos = info[10]
96 const lum = (hex: HexColor) => {
97 const rgb = hexToRgb(hex)
98 const lift = (v: number) => (v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4))
99 return 0.2126 * lift(rgb.r) + 0.7152 * lift(rgb.g) + 0.0722 * lift(rgb.b)
100 }
101 const hit = (a: HexColor, b: HexColor) => {
102 const x = lum(a)
103 const y = lum(b)

Callers 1

hitFunction · 0.85

Calls 2

hexToRgbFunction · 0.90
liftFunction · 0.70

Tested by

no test coverage detected