加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何使用Perl和Curses指定透明背景?

发布时间:2020-12-16 06:12:28 所属栏目:大数据 来源:网络整理
导读:我试图让背景成为标准的终端颜色而不是黑色,但我似乎无法弄明白.当我使用use_default_colors()时,标准就像不使用颜色,但我想改变前景色而不是背景色.我使用init_color_pair(1,COLOR_RED,COLOR_BLACK);但这给了我一个黑色的背景,我不想要的. 解决方法 为了拥
我试图让背景成为标准的终端颜色而不是黑色,但我似乎无法弄明白.当我使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读