C:亮黄色和亮绿色(ncurses)?

标签 c ncurses

我一直在寻找漂亮的颜色,例如 mc 的黄色和绿色。

在 ncurses 中,您可以指定这些 RGB:

10.2. Changing Color Definitions

The function init_color()can be used to change the rgb values for the colors defined by curses initially. Say you wanted to lighten the intensity of red color by a minuscule. Then you can use this function as

init_color(COLOR_RED, 700, 0, 0);
/* param 1     : color name
 * param 2, 3, 4 : rgb content min = 0, max = 1000 */

我找不到亮黄色或亮绿色。它们不是默认包含在 ncurses 中吗?

问候, 乌尔里希

最佳答案

你可以有“完整”的颜色,但你需要重新编译你的ncurses来支持它(并且有一些可以显示它的东西)

"To compile NCurses with 256 color support, use this option:"

--enable-ext-colors

引用:http://www.c-for-dummies.com/ncurses/256color.php根据 NCurses 维护者 Thomas Dickey 和 Dan Gookin 的说法

Color   Function                        Constant Name
0       init_color(0,0,0,0);            COLOR_BLACK
1       init_color(0,1000,0,0);         COLOR_RED
2       init_color(0,0,1000,0);         COLOR_GREEN
3       init_color(0,1000,1000,0);      COLOR_YELLOW
4       init_color(0,0,0,1000);         COLOR_BLUE
5       init_color(0,1000,0,1000);      COLOR_MAGENTA
6       init_color(0,0,1000,1000);      COLOR_CYAN
7       init_color(0,1000,1000,1000);   COLOR_WHITE
  • 可以从 NCurses 中获得超过标准 8(或 16)种颜色...

您的 TERM 环境变量也可能是 xterm,请尝试将其更改为 xterm-256color

关于C:亮黄色和亮绿色(ncurses)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15105055/

相关文章:

c - 在 ncurses 中定义新颜色

c - gcc 在内联 asm 中错误地重用寄存器

c - 使用 typedef 和 struct 创建位域

Ncurses 6.0 编译错误 - 错误 : expected ')' before 'int'

c - 使用 gdb 调试 ncurses 应用程序

改变颜色定义 ncurses C

c++ - 未初始化的两个实例之一

c - 在函数中设置指向结构体的指针的成员

c - "too many arguments for format"警告

c - 使用具有结构的指针 C 的选择排序