Created
December 5, 2009 19:09
-
-
Save lqc/249812 to your computer and use it in GitHub Desktop.
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
import curses | |
import sys | |
scr = curses.initscr() | |
curses.start_color() | |
print >> sys.stderr, curses.can_change_color() | |
# init additional 8 colors | |
for i in xrange(0, 255): | |
intesity = (1000*i/255) | |
try: | |
curses.init_color(i, intesity, 0, 0) | |
except: | |
print >> sys.stderr, "Failed to init color %d" % i | |
# init color pairs | |
for i in xrange(1, 255): | |
try: | |
curses.init_pair(i, i, 0) | |
except: | |
print >> sys.stderr, "Failed to initialize pair #%d" % i | |
pass | |
for i in xrange(0, 255): | |
try: | |
scr.addstr( str(i)+ ' ', curses.color_pair(i) ) | |
except: | |
pass | |
scr.getch() | |
curses.endwin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment