-
Notifications
You must be signed in to change notification settings - Fork 4
/
colors.py
28 lines (26 loc) · 907 Bytes
/
colors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
import os
import platform
colors = True # Output should be colored
machine = sys.platform # Detecting the os of current system
checkplatform = platform.platform()
if machine.lower().startswith(('os', 'win', 'darwin', 'ios')):
colors = False # Colors shouldn't be displayed in mac & windows
if checkplatform.startswith("Windows-10") and int(platform.version().split(".")[2]) >= 10586:
colors = True
os.system('')
if not colors:
end = green = yellow = red = white = cyan = bgreen = lgreen = lcyan = lyellow = lred = blue = ''
else:
lgreen = '\033[32m'
lcyan = '\033[96m'
lyellow = '\033[33m'
lred = '\033[31m'
white = '\033[97m'
blue = '\033[94m'
green = '\033[92m'
red = '\033[91m'
yellow = '\033[93m'
cyan = '\033[36m'
end = '\033[0m'
statuscolors = {1: cyan, 2: green, 3: lgreen, 4: yellow, 5: lred}