Using the colored gem
require 'colored' a = [] a << " test ".red a << " test ".red_on_blue a << " test ".on_red a << " test ".on_green a << " test ".black_on_white a << " test ".on_yellow a << " test ".on_orange a << " test ".on_purple a << " test ".on_brown a << " test ".red.underline a << " test ".bold.blue a << " test ".red_on_yellow puts a.join("\n")
Output:
Note: Not all the colours I specified in the string array were output. Yellow, purple, and brown were omitted.
Resources
- colored[rubygems.org]