Updated
On this page
ANSI color output support with automatic TTY detection, NO_COLOR environment variable compliance, and a reusable Colorizer class.
#claudestream._color
#claudestream._color
ANSI color output support with automatic TTY detection, NO_COLOR environment variable compliance, and a reusable Colorizer class.
#should_color
python
def should_color(stream: object | None=None, color_flag: bool=True) -> boolDetermine if color output should be used.
Returns False when:
- color_flag is False (--no-color CLI flag)
- NO_COLOR environment variable is set (https://no-color.org/)
- The stream is not a TTY (piping/redirection)
#Colorizer
Wraps text with ANSI escape codes. No-op when color is disabled.
#red
python
def red(self, text: str) -> str#yellow
python
def yellow(self, text: str) -> str#cyan
python
def cyan(self, text: str) -> str#dim
python
def dim(self, text: str) -> str#bold
python
def bold(self, text: str) -> str