在定义一个ncurses的新颜色 [英] Defining a new color in ncurses

查看:392
本文介绍了在定义一个ncurses的新颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习的ncurses,并想知道如果我可以创建自己的自定义颜色。我知道,通过使用 init_color(),我可以在ncurses库修改任何pre定义颜色。但是,有没有办法,我可以定义一个新的颜色自定义RGB值?

I am trying to learn ncurses and was wondering if I can create my own custom colors. I am aware that by using init_color(), I can modify any pre-defined colors in the ncurses library. But, is there a way I can define a new color with custom RGB values?

推荐答案

init_color()是定义新的颜色,但可用的颜色和颜色对数的唯一途径取决于你所使用的终端上。

init_color() is the only way to define new colors but the number of colors and color pairs available depends on the terminal you are using.

许多终端最多可支持256色,但在大多数系统上的默认TERM值为的xterm 只支持8的xterm可以用256色的支持下重新编译,我想GNOME终端支持256试着改变你的TERM环境变量的xterm-256color 并为您在您的ncurses程序的颜色可变的。

Many terminals can support up to 256 colors but on most systems the default TERM value is xterm which only supports 8. xterm can be compiled with 256 color support and I think gnome-terminal supports 256. Try changing your TERM enviroment variable to xterm-256color and check the COLORS variable in your ncurses program.

这篇关于在定义一个ncurses的新颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆