aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-09 12:03:25 +0100
committerGitHub Enterprise <[email protected]>2026-03-09 12:03:25 +0100
commit07649104761ee910b667adb2b865c4e2fd0979c9 (patch)
tree16445986fd35ecb79e8f2417ae4426d1f2ea3c3d /scripts
parentEliminate spdlog dependency (#773) (diff)
downloadzen-07649104761ee910b667adb2b865c4e2fd0979c9.tar.xz
zen-07649104761ee910b667adb2b865c4e2fd0979c9.zip
added auto-detection logic for console colour output (#817)
Add auto-detection of colour support to `AnsicolourStdoutSink`. **New `colorMode` enum** (`On`, `Off`, `Auto`) added to the header, accepted by the `AnsicolorStdoutSink` constructor. Defaults to `Auto`, so all existing call sites are unaffected. **`Auto` mode detection logic** (in `IscolourTerminal()`): 1. **TTY check** -- if stdout is not a terminal, colour is disabled. 2. **`NO_COLOR`** -- respects the no-colour.org convention. If set, colour is disabled. 3. **`COLORTERM`** -- if set (e.g. `truecolour`, `24bit`), colour is enabled. 4. **`TERM`** -- rejects `dumb`; accepts known colour-capable terminals via substring match: `alacritty`, `ansi`, `colour`, `console`, `cygwin`, `gnome`, `konsole`, `kterm`, `linux`, `msys`, `putty`, `rxvt`, `screen`, `tmux`, `vt100`, `vt102`, `xterm`. Substring matching covers variants like `xterm-256color` and `rxvt-unicode`. 5. **Fallback** -- Windows defaults to colour enabled (modern console supports ANSI natively); other platforms default to disabled. When colour is disabled, ANSI escape sequences are omitted entirely from the output. NOTE: this doesn't currently apply to all paths which do logging in zen as they may be determining their colour output mode separately from `AnsicolorStdoutSink`.
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions