Skip to content

Instantly share code, notes, and snippets.

@RobiMez
Last active July 14, 2022 11:57
Show Gist options
  • Save RobiMez/b844881622698cd103b41340d9d894fb to your computer and use it in GitHub Desktop.
Save RobiMez/b844881622698cd103b41340d9d894fb to your computer and use it in GitHub Desktop.
p.o(c.color , text )
"""Add colors to print"""
class C:
black = '\033[30m'
red = '\033[31m'
green = '\033[32m'
yellow = '\033[33m'
orange = '\033[34m'
purple = '\033[35m'
blue = '\033[36m'
white = '\033[37m'
b_black = '\033[90m'
b_red = '\033[91m'
b_green = '\033[92m'
b_yellow = '\033[93m'
b_orange = '\033[94m'
b_purple = '\033[95m'
b_blue = '\033[96m'
b_white = '\033[97m'
bold = '\033[1m'
faint = '\033[2m'
italic = '\033[3m'
underline = '\033[4m'
o = '\033[0m'
class P:
"""Printing class"""
@staticmethod
def o(color=C.b_black, data=' O~O - Default print',
compact=False, bold=False, faint=False):
"""Print out method"""
data = str(data)
if bold:
data = C.bold+color+data+C.o
elif faint:
data = C.faint+color+data+C.o
else:
data = color+data+C.o
if not compact:
data = '\n'+data+'\n'
print(f'{data}')
# initing the objects if user just wants to import them
p = P()
c = C()
# USAGE : p.o(c.<color>,"<data_to_print>",compact=bool,bold=bool,faint=bool)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment