From 67aee22f75dd95802bf9e305bab8e10259f340d8 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Thu, 10 Aug 2023 11:33:20 +0200 Subject: [PATCH] Full adherance to NO_COLOR standard --- src/iomanip.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iomanip.cpp b/src/iomanip.cpp index 652ac4e..b51e97e 100644 --- a/src/iomanip.cpp +++ b/src/iomanip.cpp @@ -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) { - 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) {