我试图让背景成为标准的终端颜色而不是黑色,但我似乎无法弄明白。当我使用use_default_colors()
时,标准就像不使用颜色,但我想改变前景色而不是背景色。我使用init_color_pair(1, COLOR_RED, COLOR_BLACK);
,但这给了我一个黑色背景,我不想要的。
答案 0 :(得分:1)
为了拥有透明背景,您应用的用户应该在.Xdefaults或类似内容中指定它。如果用户已经具有透明背景,那么您只需使用默认背景,如下所示:
use Curses;
#...some init here...
# colors:
use_default_colors; # mandatory, we want to use the default background which is transparent
init_pair 1, COLOR_BLUE, -1; # -1 mandatory, again, we want *default* background
init_pair 2, -1, COLOR_WHITE; # you can use the default foreground color if you like