from __future__ import print_function ESC = '\x1b[' RESET = ESC + "00m" for bg in range(40,48): for fg in range(30,38): print ("{ESC}01;{bg};{fg}mtext {RESET}".format(**locals()), end='') print () t = "{ESC}00;38;5;{i}m{i:03} {RESET}" for i in range(16): print (t.format(**locals()), end='') if i % 8 == 7: print () print () for i in range(16,232): print (t.format(**locals()), end='') if (i-16) % 6 == 5: print () if (i-16) % 36 == 35: print () print () for i in range(232,256): print (t.format(**locals()), end='') if (i-232) % 12 == 11: print () print () t = "{ESC}00;48;5;{i}m{i:03} {RESET}" for i in range(16): print (t.format(**locals()), end='') if i % 8 == 7: print () print () for i in range(16,232): print (t.format(**locals()), end='') if (i-16) % 6 == 5: print () if (i-16) % 36 == 35: print () print () for i in range(232,256): print (t.format(**locals()), end='') if (i-232) % 12 == 11: print () print () t = "{ESC}00;48;5;{bg};38;5;{fg}m{fg:03} on {bg:03} {RESET}" for bg in [2, 57, 160, 246]: for fg in [165, 102, 252, 9]: print (t.format(**locals()), end='') print() steps = range(0,256,30) t = "{ESC}00;38;2;{r};{g};{b}m{r:03}|{g:03}|{b:03} {RESET}" for r in steps: for g in steps: for b in steps: print (t.format(**locals()), end='') print() print() steps = range(0,256,30) t = "{ESC}00;48;2;{r};{g};{b}m{r:03}|{g:03}|{b:03} {RESET}" for r in steps: for g in steps: for b in steps: print (t.format(**locals()), end='') print() print()