diff --git a/sphinx/util/console.py b/sphinx/util/console.py index 48b566283..f851ea9bb 100644 --- a/sphinx/util/console.py +++ b/sphinx/util/console.py @@ -57,9 +57,13 @@ def term_width_line(text: str) -> str: def color_terminal() -> bool: + if 'NO_COLOR' in os.environ: + return False if sys.platform == 'win32' and colorama is not None: colorama.init() return True + if 'FORCE_COLOR' in os.environ: + return True if not hasattr(sys.stdout, 'isatty'): return False if not sys.stdout.isatty():