开发者

How can I specify a transparent background using Perl and Curses?

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 ini开发者_开发百科t_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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜