从红宝石色中获取256种颜色 [英] Getting 256 colors out of ruby-ncurses

查看:95
本文介绍了从红宝石色中获取256种颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的终端上有256种出色的颜色(这里的测试脚本),但是当我使用ncurses时(通过Ruby-ncurses)它将停止工作.打印该页面上给出的转义序列可以很好地工作,但是当我初始化ncurses时,"puts"停止工作,并且无法使用我发现的各种ncurses颜色更改/字符串输出函数中的任何一个来输出颜色.有什么作用?

I've got 256 colors working great in my terminal (test scripts here), but it stops working when I use ncurses (via Ruby-ncurses). Printing the escape sequences given on that page works fine, but when I initialize ncurses 'puts' stops working and I can't output the colors with any of the various ncurses color changing/string output functions I've found. What gives?

推荐答案

njsf:您只是在这里,经过大量修改后,我最终使它工作了.谢谢你的帮助.故事:XTerm(以及rxvt和Eterm)通过转义序列(我所看到的)支持256种颜色,但"tput颜色"将显示为"8",而ncurses将无法达到它们,因为ncurses的表现很好并尝试通过terminfo进行访问.

njsf: You were partially right here, and after tinkering a lot more I eventually got it to work. Thanks for your help. The story: XTerm (and rxvt, and Eterm) support 256 colors via escape sequences (what I was seeing) but 'tput colors' will say '8' and ncurses won't be able to get at them, because ncurses is playing nice and attempting to access via terminfo.

为任何遭受类似痛苦的人谋福利:

For the benefit of anyone with similar pain:

我发现我需要安装ncurses-term(Ubuntu)软件包来获取/lib/terminfo/x/xterm-256color和其他256色terminfo文件.然后我将TERM设置为xterm-256color,并将行'* customization:-color'添加到我的〜/.Xdefaults中,然后运行'xrdb -merge〜/.Xdefaults'进行加载,从那时起,我便拥有了正确的256色在新的xterms中提供支持.

I found I need to install the ncurses-term (Ubuntu) package to get /lib/terminfo/x/xterm-256color and other 256-color terminfo files. Then I set my TERM to xterm-256color and added the line '*customization: -color' to my ~/.Xdefaults, ran 'xrdb -merge ~/.Xdefaults' to load it, and from then on I have proper 256 color support in new xterms.

这篇关于从红宝石色中获取256种颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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