How to get bright white in ncurses?

How to create a color pair with a light gray background and bright white forex?

init_pair (number, COLOR_WHITE, COLOR_WHITE) creates a color pair with a light gray front and back, but I need the front to be really white. I tried combining COLOR_WHITE with A_BLINK (via bitwise OR), but this does not work. Necretes of howto's / examples / documentaion could not help either.

+6
c ncurses curses
source share
4 answers

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

+7
source share

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

This is a python example, but I hope this would be useful:

stdscr = curses.initscr() curses.start_color() curses.use_default_colors() curses.noecho() curses.cbreak() curses.init_pair(1, curses.COLOR_WHITE, -1) 
+3
source share
 WINDOW *w = newwin(...); wattron(w,A_BOLD); <Your statements for mvwprintw, box, etc> 
+3
source share

This is just a hit in the dark, I am not very good at ncurses:

If there is a function / parameter to rotate the text in bold , try it! Some text color imaging implementations use vibrant colors instead of bold.

+2
source share

All Articles