如何在 ncurses 中获得亮白色?

发布于 2024-08-14 18:00:42 字数 204 浏览 3 评论 0原文

如何初始化浅灰色背景和亮白色前景的颜色对?

init_pair(number, COLOR_WHITE, COLOR_WHITE) 创建一个具有浅灰色前景和背景的颜色对,但我需要前景是真正的白色。我尝试将 COLOR_WHITE 与 A_BLINK 组合(通过按位或),但这不起作用。 Ncurses howto's/examples/documentaion 也无法帮助我。

How to init a color pair with light grey background, and bright white foregraound?

init_pair(number, COLOR_WHITE, COLOR_WHITE) creates a color pair with light grey foreground and backround, but I need foreground to be really white. I tried combining COLOR_WHITE with A_BLINK (through bitwise OR) but that doesn't work. Ncurses howto's/examples/documentaion couldn't help me either.

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

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

发布评论

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

评论(4

ゃ懵逼小萝莉 2024-08-21 18:00:42

您需要设置粗体属性。在写入之前调用 attron(A_BOLD),在写入之后调用 attroff(A_BOLD)。

You need to set the bold attribute. Call attron(A_BOLD) before you write and attroff(A_BOLD) after.

白日梦 2024-08-21 18:00:42
WINDOW *w = newwin(...);
wattron(w,A_BOLD);
<Your statements for mvwprintw, box, etc>
WINDOW *w = newwin(...);
wattron(w,A_BOLD);
<Your statements for mvwprintw, box, etc>
找个人就嫁了吧 2024-08-21 18:00:42

我对 python+curses 也有类似的问题。
解决方案是启用use_default_colors,然后使用-1作为背景颜色。

这是 python 示例,但我希望它有用:

stdscr = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.init_pair(1, curses.COLOR_WHITE, -1)

I had similar problem with python + curses.
The solution is to enable use_default_colors and then use -1 as background color.

This is python example, but I hope it would be usefull:

stdscr = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.init_pair(1, curses.COLOR_WHITE, -1)
倾其所爱 2024-08-21 18:00:42

这只是在黑暗中刺伤,我对 ncurses 不是很了解:

如果有一个用于将文本粗体的函数/参数,请尝试一下!文本颜色映射的某些实现使用更亮的颜色来代替粗体字体。

This is just a stab in the dark, I'm not very knowledgeable about ncurses:

If there's a function/parameter for turning text bold, give that a try! Some implementations of text color mapping use brighter colors in place of a bold font.

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