Module: Styles
- Included in:
- Replicant::REPL
- Defined in:
- lib/replicant/styles.rb
Constant Summary collapse
- STYLES =
{ # foreground text :white_fg => 37, :black_fg => 30, :green_fg => 32, # background :white_bg => 47, # text styles :bold => 1 }
Instance Method Summary collapse
Instance Method Details
#span(text, *styles) ⇒ Object
16 17 18 19 20 |
# File 'lib/replicant/styles.rb', line 16 def span(text, *styles) styled = "\e[#{STYLES.values_at(*styles).join(';')}m#{text}" styled << yield if block_given? styled end |
#styled(*styles) ⇒ Object
22 23 24 |
# File 'lib/replicant/styles.rb', line 22 def styled(*styles) "\e[#{STYLES.values_at(*styles).join(';')}m" end |
#unstyled ⇒ Object
26 27 28 |
# File 'lib/replicant/styles.rb', line 26 def unstyled "\e[0m" end |