only use colors if we are in a real terminal
This commit is contained in:
parent
b2893c1fdc
commit
a6f7eac41b
1 changed files with 26 additions and 0 deletions
|
@ -22,6 +22,8 @@ from urllib import urlretrieve
|
||||||
|
|
||||||
# ROVER BASE #
|
# ROVER BASE #
|
||||||
class RoverMods:
|
class RoverMods:
|
||||||
|
PIPE_TO_STDOUT = not sys.stdout.isatty()
|
||||||
|
|
||||||
HEADER = '\033[95m'
|
HEADER = '\033[95m'
|
||||||
BLUE = '\033[94m'
|
BLUE = '\033[94m'
|
||||||
GREEN = '\033[92m'
|
GREEN = '\033[92m'
|
||||||
|
@ -34,34 +36,58 @@ class RoverMods:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Header(line):
|
def Header(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.HEADER + line + RoverMods.ENDC
|
return RoverMods.HEADER + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Blue(line):
|
def Blue(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.BLUE + line + RoverMods.ENDC
|
return RoverMods.BLUE + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Green(line):
|
def Green(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.GREEN + line + RoverMods.ENDC
|
return RoverMods.GREEN + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Yellow(line):
|
def Yellow(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.YELLOW + line + RoverMods.ENDC
|
return RoverMods.YELLOW + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def White(line):
|
def White(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.WHITE + line + RoverMods.ENDC
|
return RoverMods.WHITE + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Red(line):
|
def Red(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.RED + line + RoverMods.ENDC
|
return RoverMods.RED + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Bold(line):
|
def Bold(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.BOLD + line + RoverMods.ENDC
|
return RoverMods.BOLD + line + RoverMods.ENDC
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def Underline(line):
|
def Underline(line):
|
||||||
|
if(RoverMods.PIPE_TO_STDOUT):
|
||||||
|
return line
|
||||||
|
|
||||||
return RoverMods.UNDERLINE + line + RoverMods.ENDC
|
return RoverMods.UNDERLINE + line + RoverMods.ENDC
|
||||||
|
|
||||||
def RoverPrint(line):
|
def RoverPrint(line):
|
||||||
|
|
Loading…
Reference in a new issue