mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 21:10:27 -06:00
Don't use color if NO_COLOR environment variable is set
This commit is contained in:
@@ -48,6 +48,9 @@ def use_color(setting):
|
||||
if setting not in COLOR_CHOICES:
|
||||
raise InvalidColorSetting(setting)
|
||||
|
||||
if 'NO_COLOR' in os.environ:
|
||||
return False
|
||||
|
||||
return (
|
||||
setting == 'always' or
|
||||
(setting == 'auto' and sys.stdout.isatty() and terminal_supports_color)
|
||||
|
||||
Reference in New Issue
Block a user