Module: Aid::Colorize
- Extended by:
- Colorize
- Included in:
- Colorize, Script, Scripts::Doctor::Check
- Defined in:
- lib/aid/colorize.rb
Constant Summary collapse
- COLOR_CODES =
{ black: 30, blue: 34, brown: 33, cyan: 36, dark_gray: 90, green: 32, light_blue: 94, light_cyan: 96, light_gray: 37, light_green: 92, light_purple: 95, light_red: 91, light_yellow: 93, purple: 35, red: 31, white: 97, yellow: 33, command: 96, error: 91, info: 93, }
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/aid/colorize.rb', line 4 def self.included(base) colorize = self base.class_eval do extend colorize end end |
Instance Method Details
#colorize(color, string) ⇒ Object
36 37 38 |
# File 'lib/aid/colorize.rb', line 36 def colorize(color, string) "\e[#{COLOR_CODES[color]}m#{string}\e[0m" end |