mirror of
https://github.com/openai/codex.git
synced 2026-09-13 11:47:17 +00:00
assume true color for any Windows Terminal session.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user