Skip to content

Instantly share code, notes, and snippets.

@JerryFleming
Created March 25, 2014 12:50
Show Gist options
  • Save JerryFleming/9761211 to your computer and use it in GitHub Desktop.
Save JerryFleming/9761211 to your computer and use it in GitHub Desktop.
Display color blocks for ansi terminals.
#!/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
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
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