Created
March 25, 2014 12:50
-
-
Save JerryFleming/9761211 to your computer and use it in GitHub Desktop.
Display color blocks for ansi terminals.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding: utf8 | |
def c(color): | |
print "\x1b[0m\x1b[38;5;%sm█\x1b[1m█" % color, | |
print "System colors:" | |
for color in range(8): | |
c(color) | |
print "\x1b[0m" | |
for color in range(8, 16): | |
c(color) | |
print "\x1b[0m" | |
print "Color cube, 6x6x6:" | |
for green in range(6): | |
for red in range(6): | |
for blue in range(6): | |
color = 16 + red * 36 + green * 6 + blue | |
c(color) | |
print "\x1b[0m", | |
print "Grayscale ramp:" | |
for color in range(232, 256): | |
c(color) | |
print "\x1b[0m" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment