Last active
May 4, 2023 20:12
-
-
Save DevGW/f6d3a0a811c521d22731081a7818cd3d to your computer and use it in GitHub Desktop.
Python ANSI color class #python #ANSI
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_colors: | |
RED = '\033[91m' | |
GREEN = '\033[92m' | |
YELLOW = '\033[93m' | |
BLUE = '\033[94m' | |
PURPLE = '\033[95m' | |
CYAN = '\033[96m' | |
ENDC = '\033[0m' # Reset | |
BOLD = '\033[1m' | |
UNDERLINE = '\033[4m' | |
ITALIC = '\033[3m' | |
# Importing: | |
from ansi_colors import ansi_colors as colors | |
# Usage: | |
print(f"{ansi_colors.YELLOW}This text is yellow.{ansi_colors.ENDC}") | |
print(f"{ansi_colors.BLUE}This text is blue.) | |
print("This text is also blue.") | |
print(f"{ansi_colors.ENDC}This text is reset to normal.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment