diff --git a/codex-rs/tui/src/style.rs b/codex-rs/tui/src/style.rs index a26ff923a2..5746576b2b 100644 --- a/codex-rs/tui/src/style.rs +++ b/codex-rs/tui/src/style.rs @@ -24,10 +24,18 @@ pub fn user_message_bg(terminal_bg: (u8, u8, u8)) -> Color { (255, 255, 255) }; let bottom = terminal_bg; - let Some(color_level) = supports_color::on_cached(supports_color::Stream::Stdout) else { + let Some(mut color_level) = supports_color::on_cached(supports_color::Stream::Stdout) else { return Color::default(); }; + #[cfg(windows)] + // Windows Terminal has been the default shell application for Windows since October 2022 + // and has supported truecolor even longer. However it usually does not set COLORTERM to indicate that. + // so this is a pretty safe heuristic. + if std::env::var_os("WT_SESSION").is_some() { + color_level.has_16m = true; + } + let target = blend(top, bottom, 0.1); if color_level.has_16m { // In truecolor terminals we can use the exact RGB value.