MCPcopy Index your code
hub / github.com/anomalyco/opencode / generateMutedTextColor

Function generateMutedTextColor

packages/opencode/src/cli/cmd/run/theme.ts:369–380  ·  view source on GitHub ↗
(bg: RGBA, isDark: boolean, map: (rgba: RGBA) => RGBA)

Source from the content-addressed store, hash-verified

367}
368
369function generateMutedTextColor(bg: RGBA, isDark: boolean, map: (rgba: RGBA) => RGBA): RGBA {
370 const lum = 0.299 * bg.r * 255 + 0.587 * bg.g * 255 + 0.114 * bg.b * 255
371 const gray = isDark
372 ? lum < 10
373 ? 180
374 : Math.min(Math.floor(160 + lum * 0.3), 200)
375 : lum > 245
376 ? 75
377 : Math.max(Math.floor(100 - (255 - lum) * 0.2), 60)
378
379 return map(RGBA.fromInts(gray, gray, gray))
380}
381
382export function generateSystem(colors: TerminalColors, pick: "dark" | "light"): ThemeJson {
383 const bg_snapshot = RGBA.fromHex(colors.defaultBackground ?? colors.palette[0]!)

Callers 1

generateSystemFunction · 0.70

Calls 1

mapFunction · 0.70

Tested by

no test coverage detected