Files
codex/codex-rs/terminal-detection/Cargo.toml
T
Eric Traut 7f8dcb3e64 Detect Ghostty truecolor when SSH omits COLORTERM (#63710)
## Why

SSH can forward Ghostty's `TERM=xterm-ghostty` without `COLORTERM`,
leaving Codex to use an ANSI-16 palette for a truecolor terminal.

## What changed

Centralize stdout color detection in `codex-terminal-detection`. Upgrade
an ANSI-16 result to truecolor when `TERM` is `xterm-ghostty` and neither
`FORCE_COLOR` nor an active `CLICOLOR_FORCE` override is present.

Use the shared detection for TUI colors, including shimmer and activity
indicators. Share the existing Windows Terminal palette rules between
diff rendering and theme colors.

## Testing

Cover Ghostty's `TERM` fallback, explicit color overrides, and Windows
Terminal palette detection in unit tests. Exercise theme preview,
selection, and restoration with Ghostty's `TERM` and no `COLORTERM`.

GitOrigin-RevId: e7b6832fc7e721d5e2c23ef19df5fe55fbfeb21a
2026-11-24 18:50:19 +00:00

21 lines
368 B
TOML

[package]
name = "codex-terminal-detection"
version.workspace = true
edition.workspace = true
license.workspace = true
[lib]
name = "codex_terminal_detection"
path = "src/lib.rs"
doctest = false
[lints]
workspace = true
[dependencies]
supports-color = { workspace = true }
tracing = { workspace = true }
[dev-dependencies]
pretty_assertions = { workspace = true }