Class: RSGem::Colors
- Inherits:
-
Object
- Object
- RSGem::Colors
- Defined in:
- lib/rsgem/colors.rb
Constant Summary collapse
- MAPPING =
{ default: 39, red: 31, green: 32, yellow: 33, blue: 34, white: 97 }.freeze
Class Method Summary collapse
Class Method Details
.color_code(color) ⇒ Object
19 20 21 |
# File 'lib/rsgem/colors.rb', line 19 def color_code(color) MAPPING[color] || MAPPING[:default] end |
.colorize(string, color) ⇒ Object
15 16 17 |
# File 'lib/rsgem/colors.rb', line 15 def colorize(string, color) "\e[#{color_code(color)}m#{string}\e[0m" end |