Method not available on this version
This method is only available on newer versions. The first available version of the method is shown here.
set_color(string, *colors)
public
Set color by using a string or one of the defined
constants. If a third option is set to true, it also adds bold to the
string. This is based on Highline implementation and it automatically
appends CLEAR to the end of the returned String.
Show source
def set_color(string, *colors)
if colors.all? { |color| color.is_a?(Symbol) || color.is_a?(String) }
html_colors = colors.map { |color| lookup_color(color) }
"<span style=\"#{html_colors.join('; ')};\">#{string}</span>"
else
color, bold = colors
html_color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol)
styles = [html_color]
styles << BOLD if bold
"<span style=\"#{styles.join('; ')};\">#{string}</span>"
end
end