Skip to content

Instantly share code, notes, and snippets.

@brutasse
Created July 13, 2010 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brutasse/474080 to your computer and use it in GitHub Desktop.
Save brutasse/474080 to your computer and use it in GitHub Desktop.
Colorized shell output, some useful constants…
# Font colors #
BLACK = '\x1b[30m'
RED = '\x1b[31m'
GREEN = '\x1b[32m'
YELLOW = '\x1b[33m'
BLUE = '\x1b[34m'
PURPLE = '\x1b[35m'
PALE_BLUE = '\x1b[36m'
WHITE = '\x1b[37m'
# Background colors #
RED_BG = '\x1b[41m'
GREEN_BG = '\x1b[42m'
YELLOW_BG = '\x1b[43m'
BLUE_BG = '\x1b[44m'
PURPLE_BG = '\x1b[45m'
PALE_BLUE_BG = '\x1b[46m'
WHITE_BG = '\x1b[47m'
# Font effects #
BOLD = '\033[1m'
ITALICS = '\033[3m'
UNDERLINE = '\033[4m'
BLINK = '\033[5m'
HIGHIGHTED = '\033[7m'
END = '\033[0m'
if __name__ == '__main__':
print GREEN + "It works!" + END, RED + "Yay!" + END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment