aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/color.rs3
-rw-r--r--src/main.rs15
2 files changed, 17 insertions, 1 deletions
diff --git a/src/color.rs b/src/color.rs
index ba79353..809c66f 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -520,6 +520,9 @@ pub fn detect_color_mode() -> ColorMode {
}
// Default fallback
+ #[cfg(windows)]
+ let mut mode = ColorMode::Ansi16;
+ #[cfg(not(windows))]
let mode = ColorMode::Ansi16;
// If running on Windows, try to enable ANSI (virtual terminal processing)
diff --git a/src/main.rs b/src/main.rs
index 90fc061..23683b4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -167,7 +167,7 @@ pub fn parse_color_args(args: &Args) -> Result<ColorConfig, Box<dyn Error>> {
// Determine if ANSI is enabled (Windows toggle helper) — don't enable if --no-color
#[cfg(windows)]
- let ansi_enabled = !args.no_color && enable_windows_ansi();
+ let ansi_enabled = !args.no_color && color::enable_windows_ansi();
#[cfg(not(windows))]
let ansi_enabled = false;
@@ -505,6 +505,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Parse color-related arguments
let mut color_config = parse_color_args(&args)?;
+ if color_config.debug {
+ println!("Detected color mode: {:?}", color_config.mode);
+ println!("ANSI enabled: {}", color_config.ansi_enabled);
+ println!("NO_COLOR: {:?}", std::env::var("NO_COLOR").ok());
+ println!("COLORTERM: {:?}", std::env::var("COLORTERM").ok());
+ println!("TERM: {:?}", std::env::var("TERM").ok());
+ #[cfg(windows)]
+ {
+ println!("Windows shell hint: {:?}", color::detect_windows_shell());
+ }
+ return Ok(());
+ }
+
// If color debug is requested, print information and exit
if args.color_debug {
eprintln!("Color Debug: mode={:?}, ansi_enabled={}, rainbow={}, saturation={}, brightness={}",