Simplified NO_COLOR check

This commit is contained in:
Bob Polis 2023-08-10 10:35:47 +02:00
parent 4a3e59159e
commit e39414e571

View File

@ -25,9 +25,7 @@ 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) {
char* no_color_env {getenv("NO_COLOR")}; return !getenv("NO_COLOR") && isatty_ostream(out);
std::string no_color {no_color_env ? no_color_env : ""};
return no_color != "1" && isatty_ostream(out);
} }
bool sc::io::isatty_ostream(const std::ostream& out) { bool sc::io::isatty_ostream(const std::ostream& out) {