#!/usr/bin/env python import curses def main(stdscr): curses.start_color() curses.use_default_colors() for i in range(0, curses.COLORS): curses.init_pair(i + 1, i, -1) try: for i in range(0, 256): x = 4*(i % 16) y = int(i / 16) stdscr.addstr(y, x,str(i), curses.color_pair(i)) except curses.ERR: # End of screen reached pass stdscr.getch() curses.wrapper(main)