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

Function shift

packages/ui/src/theme/color.ts:248–255  ·  view source on GitHub ↗
(color: HexColor, value: { l?: number; c?: number; h?: number })

Source from the content-addressed store, hash-verified

246}
247
248export function shift(color: HexColor, value: { l?: number; c?: number; h?: number }): HexColor {
249 const base = hexToOklch(color)
250 return oklchToHex({
251 l: base.l + (value.l ?? 0),
252 c: base.c * (value.c ?? 1),
253 h: base.h + (value.h ?? 0),
254 })
255}
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)

Callers 5

resolveThemeVariantFunction · 0.90
contentFunction · 0.90
mapV2ForegroundFunction · 0.90
readPaletteFunction · 0.90
generateV2PrimitivesFunction · 0.90

Calls 2

hexToOklchFunction · 0.85
oklchToHexFunction · 0.85

Tested by

no test coverage detected