Skip to content

Commit a1500f1

Browse files
committed
Use CI env var for color output too
1 parent 04b3ef6 commit a1500f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plain/plain/cli/formatting.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,15 @@ def __init__(self, *args: Any, **kwargs: Any):
7979
super().__init__(*args, **kwargs)
8080

8181
# Follow CLICOLOR standard (http://bixense.com/clicolors/)
82-
# Priority: NO_COLOR > CLICOLOR_FORCE/FORCE_COLOR > CLICOLOR > isatty
82+
# Priority: NO_COLOR > CLICOLOR_FORCE/FORCE_COLOR > CI detection > CLICOLOR > isatty
8383
if os.getenv("NO_COLOR") or os.getenv("PYTEST_CURRENT_TEST"):
8484
self.color = False
8585
elif os.getenv("CLICOLOR_FORCE") or os.getenv("FORCE_COLOR"):
8686
self.color = True
87+
elif os.getenv("CI"):
88+
# Enable colors in CI/deployment environments even without TTY
89+
# This matches behavior of modern tools like uv (via Rust's anstyle)
90+
self.color = True
8791
elif os.getenv("CLICOLOR"):
8892
# CLICOLOR=1 means use colors only if TTY (Click's default behavior)
8993
pass # Let Click handle it with isatty check

0 commit comments

Comments
 (0)