I can't get white on black to work in curses in color mode. If I do not call start_color , I get white-on-black. As soon as I call start_color , everything starts to start_color gray.
If you run this script:
import sys for i in xrange(30, 38): print '\x1b[0;' + str(i) + 'm' + str(i) + ': Shiny colors \x1b[1m(bright)' print '\x1b[0m...and this is normal.'
... you are likely to see many beautiful flowers. I want and can not get, this is the last line: "... and this is normal." By setting the color pair to 0 or by requesting COLOR_WHITE, COLOR_BLACK will deliver me a non-bright # 37 from the script.
For reference, this is what I see in the Gnome terminal:
http://rpi.edu/~wellir/random/colors.png
I am programming in Python (using the curses library), so my code looks something like this:
import curses screen = curses.initscr() curses.start_color() curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) screen.clear() screen.attrset(0) screen.addstr('Hello') screen.attrset(curses.A_BOLD) screen.addstr('Hello') screen.attrset(curses.color_pair(1)) screen.addstr('Hello') screen.refresh() curses.napms(5000) curses.endwin()
... which gets me 37, 37 bright and 37.
python ncurses curses
Thanatos
source share