Module: Colors
- Included in:
- DiffString, Refiner, Riff
- Defined in:
- lib/colors.rb
Overview
ANSI Color related escape code constants
Constant Summary collapse
- ESC =
27.chr
- BOLD =
"#{ESC}[1m"
- CYAN =
"#{ESC}[36m"
- GREEN =
"#{ESC}[32m"
- RED =
"#{ESC}[31m"
- DEFAULT_COLOR =
"#{ESC}[39m"
- REVERSE =
"#{ESC}[7m"
- NOT_REVERSE =
"#{ESC}[27m"
- RESET =
"#{ESC}[m"
Instance Method Summary collapse
Instance Method Details
#reversed(string) ⇒ Object
16 17 18 |
# File 'lib/colors.rb', line 16 def reversed(string) return "#{REVERSE}#{string}#{NOT_REVERSE}" end |
#uncolor(string) ⇒ Object
20 21 22 |
# File 'lib/colors.rb', line 20 def uncolor(string) return string.gsub(/#{ESC}[^m]*m/, '') end |