module Guard::UI
def color(text, *color_options)
-
color_options
(Array
) -- the color options -
text
(String
) -- the text to colorize
def color(text, *color_options) color_code = "" color_options.each do |color_option| color_option = color_option.to_s next if color_option == "" unless color_option =~ /\d+/ color_option = const_get("ANSI_ESCAPE_#{ color_option.upcase }") end color_code += ";" + color_option end color_enabled? ? "\e[0#{ color_code }m#{ text }\e[0m" : text end