File size: 1,376 Bytes
abd2a81 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
DEBUG = '\033[31;40m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def print_info(*args):
print(bcolors.OKBLUE + " ".join(map(str, args)) + bcolors.ENDC)
def print_success(*args):
print(bcolors.OKGREEN + " ".join(map(str, args)) + bcolors.ENDC)
def print_failure(*args):
print(bcolors.FAIL + " ".join(map(str, args)) + bcolors.ENDC)
def print_error(*args):
print_failure(*args)
def print_warning(*args):
print(bcolors.WARNING + " ".join(map(str, args)) + bcolors.ENDC)
def print_debug(*args):
print(bcolors.DEBUG + " ".join(map(str, args)) + bcolors.ENDC)
def print_format_table():
"""
prints table of formatted text format options
"""
for style in range(8):
for fg in range(30, 38):
s1 = ''
for bg in range(40, 48):
format = ';'.join([str(style), str(fg), str(bg)])
s1 += '\x1b[%sm %s \x1b[0m' % (format, format)
print(s1)
print('\n')
def main():
print_format_table()
print_info("Info")
print_success("Success")
print_failure("Failure")
print_error("ERROR")
print_warning("WARNING")
print_debug("Debug")
if __name__ == '__main__':
main()
|