gmile gmile - 6 months ago 20
Ruby Question

Colorized Ruby output

Is there a proper plugin or a class to perform background and foreground text colorization within a common output console?

I remember, when programming Pascal we all used to play with

textcolor(...)
procedures to make our small educational programs look more pretty and presentational.

Is there anything similar in Ruby?

Answer

Colorize is my favorite gem! :-)

Check it out:

https://github.com/fazibear/colorize

Installation:

gem install colorize

Usage:

require 'colorize'

puts "I am now red".red
puts "I am now blue".blue
puts "Testing".yellow