Skip to content

Instantly share code, notes, and snippets.

@hvgab
Created April 4, 2018 00:39
Show Gist options
  • Select an option

  • Save hvgab/9cb6563b55761521d60f7add4d21b0e4 to your computer and use it in GitHub Desktop.

Select an option

Save hvgab/9cb6563b55761521d60f7add4d21b0e4 to your computer and use it in GitHub Desktop.
try import colorama
# *if* colorama is installed, get colors
try:
from colorama import Fore, Back, Style, init
init(autoreset=True)
# fallback so that the imported classes always exist
except ImportError:
class ColorFallback():
__getattr__ = lambda self, name: ''
Fore = Back = Style = ColorFallback()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment