문제

I am trying to get the background the standard terminal color instead of black but I can't seem to figure it out. When I use use_default_colors() the standards is just like not using colors but I would like to change the foreground color and not the background color. I use init_color_pair(1, COLOR_RED, COLOR_BLACK); but that gives me a black background, what I don't want.

도움이 되었습니까?

해결책

in order to have transparent background, the user of your app should have specified it in their .Xdefaults or something similar. If the user already has a transparent background, all you have to do, is to use the default background like so:

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