54 lines
1001 B
Python
54 lines
1001 B
Python
def main():
|
|
class coloramaFallback:
|
|
class Fore:
|
|
BLACK = ""
|
|
RED = ""
|
|
GREEN = ""
|
|
YELLOW = ""
|
|
BLUE = ""
|
|
MAGENTA = ""
|
|
CYAN = ""
|
|
WHITE = ""
|
|
RESET = ""
|
|
|
|
class Back:
|
|
BLACK = ""
|
|
RED = ""
|
|
GREEN = ""
|
|
YELLOW = ""
|
|
BLUE = ""
|
|
MAGENTA = ""
|
|
CYAN = ""
|
|
WHITE = ""
|
|
RESET = ""
|
|
|
|
class Style:
|
|
DIM = ""
|
|
NORMAL = ""
|
|
BRIGHT = ""
|
|
RESET_ALL = ""
|
|
|
|
def coloramaInit():
|
|
global colorama
|
|
coloramaSuccess = False
|
|
if not "-nocolor" in sys.argv:
|
|
try:
|
|
import colorama
|
|
colorama.init()
|
|
coloramaSuccess = True
|
|
except Exception as e:
|
|
print("Could not import/init colorama: " +str(e),file=sys.stderr)
|
|
print("Colors deactivated.\n",file=sys.stderr)
|
|
|
|
if not coloramaSuccess:
|
|
colorama = coloramaFallback
|
|
|
|
coloramaInit()
|
|
main()
|
|
|
|
global colored
|
|
def colored(color,st,bright = True):
|
|
if bright:
|
|
st = colorama.Style.BRIGHT + st
|
|
|
|
return color + st + colorama.Style.RESET_ALL |