module Rototiller::ColorText
Public Instance Methods
colorize(text, color)
click to toggle source
Colors a string of text @param text [String] the text to color @param color [Integer] ASCII-code 30-37 ascii-table.com/ansi-escape-sequences.php @return [String] formatted text with color
# File lib/rototiller/utilities/color_text.rb, line 8 def colorize(text, color) "\e[#{color}m#{text}\e[0m" end
green_text(text)
click to toggle source
Adds green color to a string of text @param text [String] The text to color @return [String] Text formatted in green color
# File lib/rototiller/utilities/color_text.rb, line 22 def green_text(text) colorize(text, 32) end
red_text(text)
click to toggle source
Adds red color to a string of text @param text [String] The text to color @return [String] Text formatted in red color
# File lib/rototiller/utilities/color_text.rb, line 29 def red_text(text) colorize(text, 31) end
yellow_text(text)
click to toggle source
Adds yellow color to a string of text @param text [String] The text to color @return [String] Text formatted in yellow color
# File lib/rototiller/utilities/color_text.rb, line 15 def yellow_text(text) colorize(text, 33) end