Created
February 23, 2013 00:27
-
-
Save philadams-zz/5017645 to your computer and use it in GitHub Desktop.
print all xterm-256 and -16 colors
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/env python | |
# Display the colors available in a terminal. | |
print "16-color mode:" | |
for color in range(0, 16) : | |
for i in range(0, 3) : | |
print "\033[0;%sm%02s\033[m" % (str(color + 30), str(color)), | |
# Programs like ls and vim use the first 16 colors of the 256-color palette. | |
print "256-color mode:" | |
for color in range(0, 256) : | |
for i in range(0, 3) : | |
print "\033[38;5;%sm%03s\033[m" % (str(color), str(color)), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment