(theme: string)
| 93 | const DEFAULT_BG: Color = { r: 0, g: 0, b: 0, a: 1 } |
| 94 | |
| 95 | function 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 |