Created
November 6, 2014 19:16
-
-
Save pmsanford/13767a160a460edbf66b to your computer and use it in GitHub Desktop.
A small python file to display all curses-supported colors on your terminal.
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 | |
def main(stdscr): | |
curses.start_color() | |
curses.use_default_colors() | |
for i in range(0, curses.COLORS): | |
curses.init_pair(i+1, i, -1) | |
colorno = 0 | |
fmt = '{0:3}: color' | |
fmtlen = len(fmt.format(0)) + 1 | |
while colorno < 256: | |
line = 0 | |
for i in range(0, int(curses.COLS / fmtlen)): | |
for j in range(0, curses.LINES): | |
stdscr.addstr(j, i * fmtlen, fmt.format(str(colorno-1)), curses.color_pair(colorno)) | |
colorno += 1 | |
stdscr.getkey() | |
curses.wrapper(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment