Skip to content

Instantly share code, notes, and snippets.

@afunTW
Last active May 25, 2016 03:17
Show Gist options
  • Save afunTW/20f2572e1c0cf746afe7b92ce3bfe399 to your computer and use it in GitHub Desktop.
Save afunTW/20f2572e1c0cf746afe7b92ce3bfe399 to your computer and use it in GitHub Desktop.
Ubuntu message wrapper
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def msg_execute(context, pre='', suf='', end='\n'):
print(bcolors.OKBLUE + pre + context + suf + bcolors.ENDC, end=end)
def msg_success(context, pre='', suf='', end='\n'):
print(bcolors.OKGREEN + pre + context + suf + bcolors.ENDC, end=end)
def msg_warning(context, pre='', suf='', end='\n'):
print(bcolors.WARNING + pre + context + suf + bcolors.ENDC, end=end)
def msg_fail(context, pre='', suf='', end='\n'):
print(bcolors.FAIL + pre + context + suf + bcolors.ENDC, end=end)
def msg_header(context, pre='', suf='', end='\n'):
print(bcolors.HEADER + pre + context + suf + bcolors.ENDC, end=end)
def msg_bold(context, pre='', suf='', end='\n'):
print(bcolors.BOLD + pre + context + suf + bcolors.ENDC, end=end)
def msg_underline(context, pre='', suf='', end='\n'):
print(bcolors.UNDERLINE + pre + context + suf + bcolors.ENDC, end=end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment