Skip to content

Commit

Permalink
Support NO_COLOR environment variable, fixing #70
Browse files Browse the repository at this point in the history
  • Loading branch information
borntyping committed Apr 13, 2021
1 parent 4d7d296 commit 58f9204
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions colorlog/colorlog.py
Expand Up @@ -147,6 +147,9 @@ def _escape_code_map(self, item: str) -> EscapeCodes:

def _blank_escape_codes(self):
"""Return True if we should be prevented from printing escape codes."""
if "NO_COLOR" in os.environ:
return True

if self.stream is not None and not self.stream.isatty():
return True

Expand Down

0 comments on commit 58f9204

Please sign in to comment.