Rainbows & Stones 4 the Wealthy
Ruby Console Coloring
The more one gets into Ruby the more great stuff he discovers. I've been into Ruby console applications recently and found a pretty neat coloring extension.
Its name is Rainbow
Its useful + it has a pretty name. Everyone likes rainbows! Its a must.
A simple gem install rainbow
to the terminal and its yours.
Supports RGB and HEX coloring as well as some pre-made color symbols like :red, :black, :green and so on.
Syntax
You simply use it on a string. Rainbow does the ANSI wrapping for you.
A simple foreground coloring example:
> require 'rainbow'
> puts "Awesome piece of Ruby text".color("#1abc9c")
> puts "Another Hipsterised Output".color(52, 73, 94)
Rainbow gives you the option for foreground and background coloring + some other not so often used text FX.
Dead simple but I love it!
Many thanks to the developers :D
Some URLs
https://github.com/sickill/rainbow
https://www.ruby-toolbox.com/projects/rainbow
https://rubygems.org/gems/rainbow