Defining a new color in ncurses

泪湿孤枕 提交于 2019-12-01 09:09:43

问题


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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/18341685/defining-a-new-color-in-ncurses

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!