Created
May 13, 2020 16:44
-
-
Save phanthaihuan/7fcd9fe3da75f3d46b0861aea0f712d4 to your computer and use it in GitHub Desktop.
How to print colored text to terminal in Python
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
def prRed(prt): print("\033[91m {}\033[00m" .format(prt)) | |
def prGreen(prt): print("\033[92m {}\033[00m" .format(prt)) | |
def prYellow(prt): print("\033[93m {}\033[00m" .format(prt)) | |
def prLightPurple(prt): print("\033[94m {}\033[00m" .format(prt)) | |
def prPurple(prt): print("\033[95m {}\033[00m" .format(prt)) | |
def prCyan(prt): print("\033[96m {}\033[00m" .format(prt)) | |
def prLightGray(prt): print("\033[97m {}\033[00m" .format(prt)) | |
def prBlack(prt): print("\033[98m {}\033[00m" .format(prt)) | |
prGreen("Hello world") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment