Class: Fastlane::Helper::Colorizer

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/translate_gpt/helper/translate_gpt_helper.rb

Overview

Helper class for bash colors

Constant Summary collapse

COLORS =
{
  black:   30,
  red:     31,
  green:   32,
  yellow:  33,
  blue:    34,
  magenta: 35,
  cyan:    36,
  white:   37,
  reset:   0,
}

Class Method Summary collapse

Class Method Details

.code(color) ⇒ Object



385
386
387
# File 'lib/fastlane/plugin/translate_gpt/helper/translate_gpt_helper.rb', line 385

def self.code(color)
  "\e[#{COLORS[color.to_sym]}m"
end

.colorize(text, color) ⇒ Object



381
382
383
384
# File 'lib/fastlane/plugin/translate_gpt/helper/translate_gpt_helper.rb', line 381

def self.colorize(text, color)
  color_code = COLORS[color.to_sym]
  "\e[#{color_code}m#{text}\e[0m"
end