更好的ruby终端着色库
发布时间:2020-12-17 02:51:41 所属栏目:百科 来源:网络整理
导读:有很多着色库:彩色,term-ansicolor. 但有没有可以做到这一点: puts "#{'hello'.red} world!".bold 和世界!应该是大胆的. 为了说清楚,我想得到这个: "e[1me[31mhelloe[0me[1m world!e[0m" 甚至更好(更短): "e[1;31mhelloe[0;1m world!e[0m" 而不
有很多着色库:彩色,term-ansicolor.
但有没有可以做到这一点: puts "#{'hello'.red} world!".bold 和世界!应该是大胆的. 为了说清楚,我想得到这个: "e[1me[31mhelloe[0me[1m world!e[0m" 甚至更好(更短): "e[1;31mhelloe[0;1m world!e[0m" 而不是这个: "e[1me[31mhelloe[0m world!e[0m" 解决方法
由于没有,我写了自己的,二十一点和妓女聪明一个 –
smart_colored
gem install smart_colored 并运行 require 'smart_colored/extend' # without extend you'll need to use 'string'.colored.red puts "#{'hello'.red} world!".bold (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |