Module: ColorFool
- Included in:
- Cue::Indicator, Cue::Item
- Defined in:
- lib/colorfool.rb
Constant Summary collapse
- COLORS =
i(green red)
- CODES =
{ black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37 }
Instance Method Summary collapse
Instance Method Details
#code(color) ⇒ Object
15 16 17 |
# File 'lib/colorfool.rb', line 15 def code(color) CODES[color] end |
#colorize(color, &block) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/colorfool.rb', line 19 def colorize(color, &block) code = code(color) content = block.call.to_s "\e[#{code}m#{content}\e[0m" end |