Skip to content

Commit

Permalink
Disable coloring with TERM=dumb or NO_COLOR
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Nov 21, 2022
1 parent f99073c commit 879a6c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tox/config/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ def add_color_flags(parser: ArgumentParser) -> None:
converter = StrConvert()
if converter.to_bool(os.environ.get("NO_COLOR", "")):
color = "no"
elif os.environ.get("TERM", "") == "dumb":
color = "no"
elif converter.to_bool(os.environ.get("FORCE_COLOR", "")):
color = "yes"
else:
Expand All @@ -299,7 +301,7 @@ def add_color_flags(parser: ArgumentParser) -> None:
"--colored",
default=color,
choices=["yes", "no"],
help="should output be enriched with colors",
help="should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined.",
)


Expand Down

0 comments on commit 879a6c0

Please sign in to comment.