MCPcopy Create free account
hub / github.com/codeaashu/claude-code / detectColorMode

Function detectColorMode

src/native-ts/color-diff/index.ts:95–99  ·  view source on GitHub ↗
(theme: string)

Source from the content-addressed store, hash-verified

93const DEFAULT_BG: Color = { r: 0, g: 0, b: 0, a: 1 }
94
95function detectColorMode(theme: string): ColorMode {
96 if (theme.includes('ansi')) return 'ansi'
97 const ct = process.env.COLORTERM ?? ''
98 return ct === 'truecolor' || ct === '24bit' ? 'truecolor' : 'color256'
99}
100
101// Port of ansi_colours::ansi256_from_rgb — approximates RGB to the xterm-256
102// palette (6x6x6 cube + 24 greys). Picks the perceptually closest index by

Callers 2

renderMethod · 0.85
renderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected