Skip to content

Instantly share code, notes, and snippets.

@solanoepalacio
Created September 5, 2019 14:01
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 solanoepalacio/4ecc4c9fce9ff4de0793f922d9204701 to your computer and use it in GitHub Desktop.
Save solanoepalacio/4ecc4c9fce9ff4de0793f922d9204701 to your computer and use it in GitHub Desktop.
python ansi colors
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')
print_format_table()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment