Skip to content

Commit

Permalink
doc/tools/print_colors.py: more stable in unfriendly environments
Browse files Browse the repository at this point in the history
  • Loading branch information
hut committed Nov 12, 2013
1 parent e94916a commit 792406e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/tools/print_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,18 @@
@wrapper
def main(win):
def print_all_colors(attr):
for c in range(0, curses.COLORS):
init_pair(c, c, -1)
win.addstr(str(c) + ' ', color_pair(c) | attr)
use_default_colors()
for c in range(-1, curses.COLORS):
try:
init_pair(c, c, 0)
except:
pass
else:
win.addstr(str(c) + ' ', color_pair(c) | attr)
start_color()
try:
use_default_colors()
except:
pass
win.addstr("available colors: %d\n\n" % curses.COLORS)
print_all_colors(0)
win.addstr("\n\n")
Expand Down

0 comments on commit 792406e

Please sign in to comment.