MCPcopy
hub / github.com/anomalyco/opencode / map

Function map

packages/opencode/src/cli/cmd/run/theme.ts:500–582  ·  view source on GitHub ↗
(
  footerTheme: TuiThemeCurrent,
  scrollbackTheme: TuiThemeCurrent,
  splash: RunSplashTheme,
  syntax?: SyntaxStyle,
  subtleSyntax?: SyntaxStyle,
)

Source from the content-addressed store, hash-verified

498}
499
500function map(
501 footerTheme: TuiThemeCurrent,
502 scrollbackTheme: TuiThemeCurrent,
503 splash: RunSplashTheme,
504 syntax?: SyntaxStyle,
505 subtleSyntax?: SyntaxStyle,
506): RunTheme {
507 const opaqueSubtleSyntax = opaqueSyntaxStyle(subtleSyntax, scrollbackTheme.background)
508 subtleSyntax?.destroy()
509 const footerBackground = alpha(footerTheme.background, 1)
510 const footerMode = mode(footerBackground)
511 const shade = fade(footerTheme.backgroundMenu, footerTheme.background, 0.12, 0.56, 0.72)
512 const surface = fade(footerTheme.backgroundMenu, footerTheme.background, 0.18, 0.76, 0.9)
513 const line = fade(footerTheme.backgroundMenu, footerTheme.background, 0.24, 0.9, 0.98)
514 const statusBase = tint(footerBackground, rgba("#000000"), footerMode === "dark" ? 0.12 : 0.06)
515 const statusAccentBase =
516 footerMode === "dark" ? tint(footerBackground, rgba("#ffffff"), 0.06) : tint(statusBase, rgba("#000000"), 0.04)
517 const collapsedStatus = footerMode === "dark" && luminance(statusBase) <= 0.04
518 // Pure-black backgrounds need a slight lift or the row disappears into the terminal background.
519 const status = collapsedStatus ? tint(statusBase, statusAccentBase, 0.7) : statusBase
520 const statusAccent = collapsedStatus ? tint(status, rgba("#ffffff"), 0.06) : statusAccentBase
521
522 return {
523 background: footerTheme.background,
524 footer: {
525 highlight: footerTheme.primary,
526 selected: footerTheme.backgroundElement,
527 selectedText: footerTheme.selectedListItemText,
528 warning: footerTheme.warning,
529 success: footerTheme.success,
530 error: footerTheme.error,
531 muted: footerTheme.textMuted,
532 text: footerTheme.text,
533 status,
534 statusAccent,
535 shade,
536 surface,
537 pane: footerTheme.backgroundMenu,
538 border: footerTheme.border,
539 line,
540 },
541 entry: {
542 system: {
543 body: scrollbackTheme.textMuted,
544 },
545 user: {
546 body: scrollbackTheme.primary,
547 },
548 assistant: {
549 body: scrollbackTheme.text,
550 },
551 reasoning: {
552 body: scrollbackTheme.textMuted,
553 },
554 tool: {
555 body: scrollbackTheme.text,
556 start: scrollbackTheme.textMuted,
557 },

Callers 6

grayFunction · 0.70
generateMutedTextColorFunction · 0.70
resolveRunThemeFunction · 0.70
promptProviderFunction · 0.50
promptModelFunction · 0.50
providers.tsFile · 0.50

Calls 8

opaqueSyntaxStyleFunction · 0.85
alphaFunction · 0.85
fadeFunction · 0.85
rgbaFunction · 0.85
modeFunction · 0.70
tintFunction · 0.70
luminanceFunction · 0.70
destroyMethod · 0.65

Tested by

no test coverage detected