Skip to content

Commit 1bf9ff7

Browse files
committed
Don't use color if NO_COLOR environment variable is set
1 parent 1bd9bfe commit 1bf9ff7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pre_commit/color.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ def use_color(setting):
4848
if setting not in COLOR_CHOICES:
4949
raise InvalidColorSetting(setting)
5050

51+
if 'NO_COLOR' in os.environ:
52+
return False
53+
5154
return (
5255
setting == 'always' or
5356
(setting == 'auto' and sys.stdout.isatty() and terminal_supports_color)

0 commit comments

Comments
 (0)