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.
To use color, you must call the start_color() function soon after calling initscr() , to initialize the default color set (the curses. wrapper() function does this automatically). Once that's done, the has_colors() function returns TRUE if the terminal in use can actually display color.
You need to set the bold attribute. Call attron(A_BOLD) before you write and attroff(A_BOLD) after.
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)
WINDOW *w = newwin(...);
wattron(w,A_BOLD);
<Your statements for mvwprintw, box, etc>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With