Skip to content

Commit 879a6c0

Browse files
committed
Disable coloring with TERM=dumb or NO_COLOR
Fixes: #1290 Related: https://no-color.org/
1 parent f99073c commit 879a6c0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tox/config/cli/parser.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ def add_color_flags(parser: ArgumentParser) -> None:
290290
converter = StrConvert()
291291
if converter.to_bool(os.environ.get("NO_COLOR", "")):
292292
color = "no"
293+
elif os.environ.get("TERM", "") == "dumb":
294+
color = "no"
293295
elif converter.to_bool(os.environ.get("FORCE_COLOR", "")):
294296
color = "yes"
295297
else:
@@ -299,7 +301,7 @@ def add_color_flags(parser: ArgumentParser) -> None:
299301
"--colored",
300302
default=color,
301303
choices=["yes", "no"],
302-
help="should output be enriched with colors",
304+
help="should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined.",
303305
)
304306

305307

0 commit comments

Comments
 (0)