tags:

views:

324

answers:

3

How to init a color pair with light grey background, and bright white foregraound?

init_pair(number, COLOR_WHITE, COLOR_WHITE) creates a color pair with light grey foreground and backround, but I need foreground to be really white. I tried combining COLOR_WHITE with A_BLINK (through bitwise OR) but that doesn't work. Ncurses howto's/examples/documentaion couldn't help me either.

+2  A: 

This is just a stab in the dark, I'm not very knowledgeable about ncurses:

If there's a function/parameter for turning text bold, give that a try! Some implementations of text color mapping use brighter colors in place of a bold font.

Carl Smotricz
A: 

I had similar problem with python + curses. The solution is to enable use_default_colors and then use -1 as background color.

This is python example, but I hope it would be usefull:

stdscr = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.init_pair(1, curses.COLOR_WHITE, -1)
idavydov
A: 

You need to set the bold attribute. Call attron(A_BOLD) before you write and attroff(A_BOLD) after.

jimrandomh