Class: DevSuite::Utils::Color::Strategy::Basic

Inherits:
Base show all
Defined in:
lib/dev_suite/utils/color/strategy/basic.rb

Instance Method Summary collapse

Methods inherited from DevSuite::Utils::Construct::Component::Base

component_key

Instance Method Details

#colorize(text, color: :default) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/dev_suite/utils/color/strategy/basic.rb', line 8

def colorize(text, color: :default)
  unless valid_color_code?(color)
    raise ArgumentError, "Invalid color code"
  end

  "\e[#{color}m#{text}\e[0m"
end