Skip to content

Commit 2a700cf

Browse files
committed
Enable FORCE_COLOR and NO_COLOR for terminal colouring
1 parent b3812f7 commit 2a700cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sphinx/util/console.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ def term_width_line(text: str) -> str:
5757

5858

5959
def color_terminal() -> bool:
60+
if 'NO_COLOR' in os.environ:
61+
return False
6062
if sys.platform == 'win32' and colorama is not None:
6163
colorama.init()
6264
return True
65+
if 'FORCE_COLOR' in os.environ:
66+
return True
6367
if not hasattr(sys.stdout, 'isatty'):
6468
return False
6569
if not sys.stdout.isatty():

0 commit comments

Comments
 (0)