From af89cae735d600d3371708d64c0a5be26a699ed6 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 1 Apr 2026 16:24:16 +0000 Subject: [PATCH] Fix NO_COLOR spec non-compliance: respect any value, not just "1" The NO_COLOR spec (no-color.org) requires that the mere presence of the NO_COLOR environment variable disables color, regardless of its value. Previously, only NO_COLOR=1 was honored. Now any set value (including NO_COLOR=0 or NO_COLOR=yes) correctly disables color output. https://claude.ai/code/session_01Rq3JHKjsKVPhhn8QFPQAnf --- .../python3/dist-packages/unicode_show/tests/unicode_show.py | 2 +- usr/lib/python3/dist-packages/unicode_show/unicode_show.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/lib/python3/dist-packages/unicode_show/tests/unicode_show.py b/usr/lib/python3/dist-packages/unicode_show/tests/unicode_show.py index dff4ff3e..911aacce 100644 --- a/usr/lib/python3/dist-packages/unicode_show/tests/unicode_show.py +++ b/usr/lib/python3/dist-packages/unicode_show/tests/unicode_show.py @@ -480,7 +480,7 @@ def test_pty_color(self) -> None: self._test_stdin_pty( main_func=unicode_show_main, argv0=self.argv0, - stdout_string=expect_string_color, + stdout_string=expect_string_nocolor, exit_code=1, args=[], stdin_string=test_string, diff --git a/usr/lib/python3/dist-packages/unicode_show/unicode_show.py b/usr/lib/python3/dist-packages/unicode_show/unicode_show.py index 6a5c01a3..671586f9 100644 --- a/usr/lib/python3/dist-packages/unicode_show/unicode_show.py +++ b/usr/lib/python3/dist-packages/unicode_show/unicode_show.py @@ -174,7 +174,7 @@ def main() -> int: global USE_COLOR USE_COLOR = ( not os.getenv("NOCOLOR") - and os.getenv("NO_COLOR") != "1" + and os.getenv("NO_COLOR") is None and os.getenv("TERM") != "dumb" and sys.stdout.isatty() )