Class: DevSuite::Utils::Color::Strategy::Rgb
- Inherits:
-
Base
- Object
- DevSuite::Utils::Construct::Component::Base
- Base
- DevSuite::Utils::Color::Strategy::Rgb
- Defined in:
- lib/dev_suite/utils/color/strategy/rgb.rb
Instance Method Summary collapse
Methods inherited from DevSuite::Utils::Construct::Component::Base
Instance Method Details
#colorize(text, **kwargs) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/dev_suite/utils/color/strategy/rgb.rb', line 8 def colorize(text, **kwargs) r, g, b = kwargs.values_at(:r, :g, :b) unless valid_rgb?(r, g, b) raise ArgumentError, "RGB values must be integers between 0 and 255" end "\e[38;2;#{r};#{g};#{b}m#{text}\e[0m" end |