6

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.

4

4 回答 4

7

您需要设置粗体属性。在你写之前调用 attron(A_BOLD),之后调用 attroff(A_BOLD)。

于 2010-03-10T00:05:39.603 回答
3
WINDOW *w = newwin(...);
wattron(w,A_BOLD);
<Your statements for mvwprintw, box, etc>
于 2011-02-02T13:29:47.720 回答
3

我对 python + curses 有类似的问题。解决方案是启用 use_default_colors 然后使用 -1 作为背景颜色。

这是python示例,但我希望它有用:

stdscr = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.init_pair(1, curses.COLOR_WHITE, -1)
于 2010-03-09T23:59:50.813 回答
2

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.

于 2009-12-13T11:08:17.770 回答