From 3f1a120074ae8b2a7af601f47cda1ba0c7f22661 Mon Sep 17 00:00:00 2001 From: Jun Wu Date: Fri, 3 Nov 2023 10:33:15 -0700 Subject: [PATCH] Detect true color set by max_colors Terminals like `xterm-direct` has max_colors set to 16M. They should be treated as supporting true colors. --- termwiz/src/caps/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/termwiz/src/caps/mod.rs b/termwiz/src/caps/mod.rs index b8936b917..9d3c8bd71 100644 --- a/termwiz/src/caps/mod.rs +++ b/termwiz/src/caps/mod.rs @@ -219,7 +219,9 @@ impl Capabilities { if has_true_color { ColorLevel::TrueColor } else if let Some(cap::MaxColors(n)) = db.get::() { - if n >= 256 { + if n >= 16777216 { + ColorLevel::TrueColor + } else if n >= 256 { ColorLevel::TwoFiftySix } else { ColorLevel::Sixteen