Better ruby terminal coloring library

大兔子大兔子 提交于 2019-12-04 10:44:08

As there is none, I wrote my own, with blackjack and hookers smart one — smart_colored

gem install smart_colored

and run

require 'smart_colored/extend'
# without extend you'll need to use 'string'.colored.red

puts "#{'hello'.red} world!".bold

The lib is called Highline It has a color method: say("This should be <%= color('bold', BOLD) %>!") Which can be easily used to implement String#bold.

In case you are using highline I made a gem that extends colors and provides helpers such as:

say_bold 'this is bold text'

https://github.com/bonzofenix/highline-color

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