Overview
We can use the colorize gem for the same
https://github.com/fazibear/colorize
Just install the Gem
gem install colorize
Program
require 'colorize'
puts "Printing Blue Color".colorize(:blue)
puts "Printing Red Color".colorize(:red)
puts "Printing Yellow Color".colorize(:yellow)
puts "Printing Gree Color".colorize(:green)
Output
You can also check all color options by running the below code
puts String.colors
It will output
black
light_black
red
light_red
green
light_green
yellow
light_yellow
blue
light_blue
magenta
light_magenta
cyan
light_cyan
white
light_white
default