Disable color if TERM=dumb is detected

This commit is contained in:
Anthony Sottile 2019-07-27 13:46:30 -07:00
parent 376d283ba3
commit 120cae9d41
2 changed files with 18 additions and 4 deletions

View file

@ -49,6 +49,10 @@ def use_color(setting):
raise InvalidColorSetting(setting)
return (
setting == 'always' or
(setting == 'auto' and sys.stdout.isatty() and terminal_supports_color)
setting == 'always' or (
setting == 'auto' and
sys.stdout.isatty() and
terminal_supports_color and
os.getenv('TERM') != 'dumb'
)
)