Skip to content

Instantly share code, notes, and snippets.

@Sid110307
Created December 12, 2021 14:33
Show Gist options
  • Save Sid110307/e857f8f7e7971e572aaae9de819ffac3 to your computer and use it in GitHub Desktop.
Save Sid110307/e857f8f7e7971e572aaae9de819ffac3 to your computer and use it in GitHub Desktop.
Quick help for ANSI Colors. Made with Python 3.
#!/usr/bin/env python3
for i in range(30, 37 + 1):
print("\033[%dm%d\t\t\033[%dm%d" % (i, i, i + 60, i + 60))
print("\033[39m\\033[49m - Reset color")
print("\\033[2K - Clear Line")
print("\\033[<L>;<C>H or \\033[<L>;<C>f - Put the cursor at line L and column C.")
print("\\033[<N>A - Move the cursor up N lines")
print("\\033[<N>B - Move the cursor down N lines")
print("\\033[<N>C - Move the cursor forward N columns")
print("\\033[<N>D - Move the cursor backward N columns\n")
print("\\033[2J - Clear the screen, move to (0,0)")
print("\\033[K - Erase to end of line")
print("\\033[s - Save cursor position")
print("\\033[u - Restore cursor position\n")
print("\\033[4m - Underline on")
print("\\033[24m - Underline off\n")
print("\\033[1m - Bold on")
print("\\033[21m - Bold off")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment