MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / resolveThemeColors

Function resolveThemeColors

cli/src/utils/theme-config.ts:84–103  ·  view source on GitHub ↗
(theme: ChatTheme, mode: 'dark' | 'light')

Source from the content-addressed store, hash-verified

82 * Components should never see 'default' - it's resolved during theme building
83 */
84const resolveThemeColors = (theme: ChatTheme, mode: 'dark' | 'light'): void => {
85 const defaultFallback = mode === 'dark' ? '#ffffff' : '#000000'
86
87 const resolve = (value: string, fallback: string = defaultFallback): string => {
88 if (typeof value === 'string') {
89 const normalized = value.trim().toLowerCase()
90 if (normalized === 'default' || normalized.length === 0) {
91 return fallback
92 }
93 return value
94 }
95 return fallback
96 }
97
98 // Resolve all ThemeColor properties to actual colors
99 theme.foreground = resolve(theme.foreground)
100 theme.muted = resolve(theme.muted)
101 theme.inputFg = resolve(theme.inputFg)
102 theme.inputFocusedFg = resolve(theme.inputFocusedFg)
103}
104
105/**
106 * Build a complete theme by applying custom colors and plugins

Callers 1

buildThemeFunction · 0.85

Calls 1

resolveFunction · 0.70

Tested by

no test coverage detected