Skip to content

Commit cd905ec

Browse files
committed
Add NO_COLOR support
1 parent df939d3 commit cd905ec

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎mps_youtube/c.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
import re
55
import sys
66

7-
87
if sys.stdout.isatty():
98
white = "\x1b[%sm" % 0
10-
ul = "\x1b[%sm" * 3 % (2, 4, 33)
9+
ul = "\x1b[%sm" * 2 % (2, 4)
10+
11+
if not os.getenv('NO_COLOR'):
12+
ul += "\x1b[%33m"
13+
1114
cols = ["\x1b[%sm" % n for n in range(91, 96)]
12-
red, green, yellow, blue, pink = cols
15+
red, green, yellow, blue, pink = [""]*5 if os.getenv('NO_COLOR') else cols
1316
else:
1417
ul = red = green = yellow = blue = pink = white = ""
1518

0 commit comments

Comments
 (0)