MCPcopy Index your code
hub / github.com/codeaashu/claude-code / detectFromColorFgBg

Function detectFromColorFgBg

src/utils/systemTheme.ts:109–119  ·  view source on GitHub ↗

* Read $COLORFGBG for a synchronous initial guess before the OSC 11 * round-trip completes. Format is `fg;bg` (or `fg;other;bg`) where values * are ANSI color indices. rxvt convention: bg 0–6 or 8 are dark; bg 7 * and 9–15 are light. Only set by some terminals (rxvt-family, Konsole, * iTerm2 wit

()

Source from the content-addressed store, hash-verified

107 * iTerm2 with the option enabled), so this is a best-effort hint.
108 */
109function detectFromColorFgBg(): SystemTheme | undefined {
110 const colorfgbg = process.env['COLORFGBG']
111 if (!colorfgbg) return undefined
112 const parts = colorfgbg.split(';')
113 const bg = parts[parts.length - 1]
114 if (bg === undefined || bg === '') return undefined
115 const bgNum = Number(bg)
116 if (!Number.isInteger(bgNum) || bgNum < 0 || bgNum > 15) return undefined
117 // 0–6 and 8 are dark ANSI colors; 7 (white) and 9–15 (bright) are light.
118 return bgNum <= 6 || bgNum === 8 ? 'dark' : 'light'
119}
120

Callers 1

getSystemThemeNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected