Skip to content

Fix NO_COLOR spec compliance for empty-string edge case#20

Open
assisted-by-ai wants to merge 1 commit into
masterfrom
claude/debug-unicode-show-Gn083
Open

Fix NO_COLOR spec compliance for empty-string edge case#20
assisted-by-ai wants to merge 1 commit into
masterfrom
claude/debug-unicode-show-Gn083

Conversation

@assisted-by-ai
Copy link
Copy Markdown
Owner

Summary

  • Change not os.getenv("NO_COLOR") to os.getenv("NO_COLOR") is None in the color detection logic. The previous check treated NO_COLOR="" as falsy, keeping color enabled. Per the no-color.org spec, the mere presence of NO_COLOR (regardless of value) should disable color.
  • Add a test case for NO_COLOR=0 asserting that color is disabled, validating spec-compliant behavior.

Test plan

  • Run unicode_show test suite — all existing tests pass, new NO_COLOR=0 case passes
  • Verify NO_COLOR="", NO_COLOR=0, NO_COLOR=1 all suppress color output
  • Verify unsetting NO_COLOR allows color output on a TTY

https://claude.ai/code/session_014Qvwfhuw1DH4BJNdzrM6x1


Generated by Claude Code

- NO_COLOR check now disables color when the variable is present
  regardless of value, per the no-color.org spec. Previously only
  NO_COLOR=1 was honored.
- Fix transposed "ji" → "ij" in test_clean_ascii alphabet string.
- Update test_pty_color to expect no-color output when NO_COLOR=0,
  matching the corrected behavior.

https://claude.ai/code/session_014Qvwfhuw1DH4BJNdzrM6x1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants