Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/tweemux/core_ext.rb
Constant Summary collapse
- COLORS =
Pallete viewable from:
https://github.com/sharpsaw/tmux-dots/blob/master/bin/colortest
{ :middle_blue => 69, :heading => 69, :brighty_blue => 39, :command => 39, :gray245 => 245, :orange => 172, :pale_yellow => 180, :lemon => 228, :keypress => 157, :prompt => 35, :number => 48, :keyword => 60, :host => 148, :error => 160, :error_explanation => 178, :default => 7 }
Instance Method Summary collapse
Instance Method Details
#color(this_color, end_on = :default) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/tweemux/core_ext.rb', line 22 def color this_color, end_on = :default [this_color, end_on].each{|e| fail "No color named #{e}" unless COLORS[e]} if $stderr.tty? "\e[38;5;#{COLORS[this_color]}m#{self}\e[38;5;#{COLORS[end_on]}m" else self end end |