ncurses透明控制台背景

发布于 2024-08-24 12:14:25 字数 296 浏览 5 评论 0原文

我的控制台启用了透明度,当我运行其他 ncurses 应用程序时,我看到背景保持透明。我试图让我的应用程序保持透明度而不应用深黑色不透明背景。

这就是我到目前为止正在做的事情

start_color();
init_pair(1, COLOR_GREEN, COLOR_BLACK);

attron(COLOR_PAIR(1));
mvprintw(10,10, "Hello");

refresh();
attroff(COLOR_PAIR(1));

有什么想法吗?

谢谢

My console has transparency enabled, when I run other ncurses apps, I see the the background stays transparent. I'm trying to make my app keep the transparency and not apply a dark black opaque background.

This is what I'm doing so far

start_color();
init_pair(1, COLOR_GREEN, COLOR_BLACK);

attron(COLOR_PAIR(1));
mvprintw(10,10, "Hello");

refresh();
attroff(COLOR_PAIR(1));

Any ideas?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仙气飘飘 2024-08-31 12:14:25

如果您的应用程序调用 use_default_colors,则 ncurses (和 NetBSD curses)提供基于 ECMA-48 SGR 39 的扩展49“默认颜色”。当您执行此操作时,ncurses 会避免显式着色其前景色和/或背景色与其对终端颜色的假设相匹配的单元格。

还有一个附加函数 assume_default_colors,可用于改进默认颜色功能,其中终端(例如)在白色背景上使用黑色文本。

您使用的大多数支持颜色的终端都支持 SGR 39/49 代码,因此该功能在大多数情况下都可以使用。

进一步阅读:

If your application calls use_default_colors, ncurses (and NetBSD curses) provide an extension based on ECMA-48 SGR 39 and 49 "default colors". When you do this, ncurses refrains from explicitly coloring cells whose foreground and/or background color match its assumption about the terminal colors.

There is an additional function assume_default_colors which can be used to improve the default-colors feature where the terminal is (for example) using black text on a white background.

Most of the color-capable terminals you use support the SGR 39/49 codes, so the feature can be used most of the time.

Further reading:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文