aboutsummaryrefslogtreecommitdiffstats
path: root/unix/colortest.py
blob: 2d295909bcef19bc5d7d92d8bb2176b9e6d22ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python
#
# http://askubuntu.com/questions/27314/script-to-display-all-terminal-colors

import sys

terse = "-t" in sys.argv[1:] or "--terse" in sys.argv[1:]

for i in range(2 if terse else 10):
    for j in range(30, 38):
        for k in range(40, 48):
            if terse:
                print "\33[%d;%d;%dm%d;%d;%d\33[m " % (i, j, k, i, j, k),
            else:
                print ("%d;%d;%d: \33[%d;%d;%dm Hello, World! \33[m " %
                    (i, j, k, i, j, k, ))
        print