From e39414e57145cef27e450728a168e772f3a31d90 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Thu, 10 Aug 2023 10:35:47 +0200 Subject: [PATCH] Simplified NO_COLOR check --- src/iomanip.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/iomanip.cpp b/src/iomanip.cpp index b403bbe..652ac4e 100644 --- a/src/iomanip.cpp +++ b/src/iomanip.cpp @@ -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) { - char* no_color_env {getenv("NO_COLOR")}; - std::string no_color {no_color_env ? no_color_env : ""}; - return no_color != "1" && isatty_ostream(out); + return !getenv("NO_COLOR") && isatty_ostream(out); } bool sc::io::isatty_ostream(const std::ostream& out) {