Last active
August 11, 2022 11:10
-
-
Save asilbalaban/1fa998e410e8ad5ee4d3c48d1e629c8a to your computer and use it in GitHub Desktop.
colored print
This file contains hidden or 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 color: | |
| listOfColors = { | |
| "info": "\033[94m", | |
| "secondary": "\033[2m", | |
| "success": "\033[92m", | |
| "warning": "\033[0;33m", | |
| "danger": "\033[0;31m", | |
| "bg_info": "\033[0;44m", | |
| "bg_secondary": '\033[07m', | |
| "bg_success": "\033[0;42m", | |
| "bg_warning": "\033[0;43m", | |
| "bg_danger": "\033[0;41m", | |
| "bold": "\033[1m", | |
| "underline": "\033[4m", | |
| "italic": "\033[3m", | |
| "reset_colour": '\033[0m' | |
| } | |
| def print(text, colour = None): | |
| if(colour): | |
| string = color.listOfColors[colour] + text + color.listOfColors["reset_colour"] | |
| else: | |
| string = text | |
| print(string) | |
| if __name__ == '__main__': | |
| color.print("merhaba dünya!", "success") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment