我试图使背景获得标准终端颜色,而不是黑色,但我似乎无法弄清楚。当我使用时 use_default_colors() 标准就像不使用颜色一样,但我想更改前景颜色,而不是背景颜色。我用 init_color_pair(1, COLOR_RED, COLOR_BLACK); 但这给了我黑色的背景,我不想要。

有帮助吗?

解决方案

为了具有透明的背景,您的应用程序的用户应在其.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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top