Skip to content

Instantly share code, notes, and snippets.

@asilbalaban
Last active August 11, 2022 11:10
Show Gist options
  • Select an option

  • Save asilbalaban/1fa998e410e8ad5ee4d3c48d1e629c8a to your computer and use it in GitHub Desktop.

Select an option

Save asilbalaban/1fa998e410e8ad5ee4d3c48d1e629c8a to your computer and use it in GitHub Desktop.
colored print
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