Created
October 1, 2023 15:05
-
-
Save joaoreboucas1/66c30eb32de488c3d10972fd7eb41617 to your computer and use it in GitHub Desktop.
Rainbow Hello! Prints different colored "Hello"s in the terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ansi: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' | |
OKCYAN = '\033[96m' | |
OKGREEN = '\033[92m' | |
WARNING = '\033[93m' | |
FAIL = '\033[91m' | |
ENDC = '\033[0m' | |
BOLD = '\033[1m' | |
PINK = '\x1b[38;5;207m' | |
PURPLE = '\x1b[38;5;127m' | |
def colors256(ID): | |
# https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#256-colors | |
return f'\x1b[38;5;{ID}m' | |
def print_ansi(message, ansi_char, **kwargs): | |
print(ansi_char + message + ansi.ENDC, **kwargs) | |
for i in range(256): | |
print_ansi('Hello', ansi.colors256(i), end=' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment