fix: setting NO_COLOR should not print ansi codes for non-terminals

closes #380
This commit is contained in:
Boshen 2024-06-12 00:11:21 +08:00
parent b82cc81b8e
commit b30ef81214
No known key found for this signature in database
GPG Key ID: 9C7A8C8AB22BEBD1
1 changed files with 1 additions and 1 deletions

View File

@ -71,7 +71,7 @@ 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::ascii()
Self::none()
}
Ok(string) if string != "0" => Self::unicode_nocolor(),
_ => Self::unicode(),