Module: TestConsole::Colors
- Included in:
- TestConsole, Help, Output, Runner
- Defined in:
- lib/test_console/colors.rb
Constant Summary collapse
- COLORS =
Standard terminal color codes
{ :reset => '0', :bold => '1', :red => '31', :green => '32', :yellow => '33', :blue => '34', :magenta => '35', :cyan => '36', :white => '37' }
Instance Method Summary collapse
Instance Method Details
#color(text, color) ⇒ Object
17 18 19 20 21 |
# File 'lib/test_console/colors.rb', line 17 def color(text, color) if COLORS[color] "#{start_color color}#{text}#{reset_color}" end end |
#reset_color ⇒ Object
23 24 25 |
# File 'lib/test_console/colors.rb', line 23 def reset_color "\e[#{COLORS[:reset]}m" end |
#start_color(color) ⇒ Object
27 28 29 |
# File 'lib/test_console/colors.rb', line 27 def start_color color "\e[#{COLORS[color]}m" end |