-
-
Notifications
You must be signed in to change notification settings - Fork 128
Description
Setting NO_COLOR=1
(or 0) does not change the printing behavior in a no-tty situation.
This code seems to be why:
Lines 70 to 80 in 59c8161
impl Default for GraphicalTheme { | |
fn default() -> Self { | |
match std::env::var("NO_COLOR") { | |
_ if !std::io::stdout().is_terminal() || !std::io::stderr().is_terminal() => { | |
Self::none() | |
} | |
Ok(string) if string != "0" => Self::unicode_nocolor(), | |
_ => Self::unicode(), | |
} | |
} | |
} |
It indiscriminately causes the theme to be set as ascii/no colors, no matter what the env variable says.
This is unfortunate, as I am testing for this output and having different settings in my CI and my CLI causes my tests to mismatch. I was hoping that some form of ENV variable would help me here, but it does not seem to depend on this.
Could this use-case be considered? I am not sure whether NO_COLOR should change whether one uses unicode/ascii. A new (non-standard) env variable is also not suuuper great.
Edit:
I just realized it's actually worse for me, as I cannot influence that match at all right now. Since with NO_COLOR its still UNICODE in my CLI.