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

Function linear

packages/ui/src/theme/color.ts:258–258  ·  view source on GitHub ↗
(c: number)

Source from the content-addressed store, hash-verified

256
257export function contrastRatio(foreground: HexColor, background: HexColor) {
258 const linear = (c: number) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)
259 const luminance = (hex: HexColor) => {
260 const { r, g, b } = hexToRgb(hex)
261 return 0.2126 * linear(r) + 0.587 * linear(g) + 0.0722 * linear(b)

Callers 1

luminanceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected