Full adherance to NO_COLOR standard

This commit is contained in:
Bob Polis 2023-08-10 11:33:20 +02:00
parent e39414e571
commit 67aee22f75

View File

@ -25,7 +25,8 @@ static std::ostream& rgb(std::ostream& out, int r, int g, int b, int code) {
} }
bool sc::io::should_color(const std::ostream& out) { bool sc::io::should_color(const std::ostream& out) {
return !getenv("NO_COLOR") && isatty_ostream(out); char* no_color = getenv("NO_COLOR");
return !(no_color && no_color[0] != '\0') && isatty_ostream(out);
} }
bool sc::io::isatty_ostream(const std::ostream& out) { bool sc::io::isatty_ostream(const std::ostream& out) {