module Ougai::Formatters::Colors
def color_text(color, text, reset = Ougai::Formatters::Colors::RESET)
-
(String)
- colored or uncolored text
Parameters:
-
reset
(String
) -- reset font styling escape sequence -
text
(String
) -- text to be colored -
color
(String
) -- color to prepend. Color can be from the list
def color_text(color, text, reset = Ougai::Formatters::Colors::RESET) return text if color.nil? # .concat is preferred in Ruby: # https://coderwall.com/p/ac5j9g/or-concat-what-is-faster-for-appending-string-in-ruby ''.dup.concat(color).concat(text).concat(reset) end