module Canon::DiffFormatter::DiffDetailFormatterHelpers::ColorHelper

def self.colorize(text, color, use_color, bold: false)

Returns:
  • (String) - Colorized text (or plain text if use_color is false)

Parameters:
  • bold (Boolean) -- Whether to make text bold
  • use_color (Boolean) -- Whether to use colors
  • color (Symbol) -- Color name
  • text (String) -- Text to colorize
def self.colorize(text, color, use_color, bold: false)
  return text unless use_color
  presenter = Rainbow(text).public_send(color)
  presenter = presenter.bright if bold
  presenter.to_s
end