monchovarela
10/14/2018 - 6:11 PM

Basic Terminal colors #python

Basic Terminal colors #python


black = '1;1;40' 
red = '7;20;41'  
green = '7;30;42'  
yellow = '7;30;43'  
blue = '7;20;44'  
pink = '7;20;45'  
aqua = '7;30;46'
white = '7;30;47' 

def text(txt,color=black):
    c = '\x1b[%sm%s\x1b[0m' % (color, txt)
    print(c)


colors = (black,red,green,yellow,blue,pink,aqua,white)
for color in colors:
    text("    hello World    ",color)