class Rainbow::Presenter
Constants
- TERM_EFFECTS
Public Instance Methods
Source
# File lib/rainbow/presenter.rb, line 27 def background(*values) wrap_with_sgr(Color.build(:background, values).codes) end
Sets background color of this text.
Also aliased as: bg
Source
# File lib/rainbow/presenter.rb, line 69 def blink wrap_with_sgr(TERM_EFFECTS[:blink]) end
Turns on blinking attribute for this text (not well supported by terminal emulators).
Source
# File lib/rainbow/presenter.rb, line 42 def bright wrap_with_sgr(TERM_EFFECTS[:bright]) end
Turns on bright/bold for this text.
Also aliased as: bold
Source
# File lib/rainbow/presenter.rb, line 19 def color(*values) wrap_with_sgr(Color.build(:foreground, values).codes) end
Sets color of this text.
Also aliased as: foreground, fg
Source
# File lib/rainbow/presenter.rb, line 50 def faint wrap_with_sgr(TERM_EFFECTS[:faint]) end
Turns on faint/dark for this text (not well supported by terminal emulators).
Also aliased as: dark
Source
# File lib/rainbow/presenter.rb, line 79 def hide wrap_with_sgr(TERM_EFFECTS[:hide]) end
Hides this text (set its color to the same as background).
Source
# File lib/rainbow/presenter.rb, line 74 def inverse wrap_with_sgr(TERM_EFFECTS[:inverse]) end
Inverses current foreground/background colors.
Source
# File lib/rainbow/presenter.rb, line 58 def italic wrap_with_sgr(TERM_EFFECTS[:italic]) end
Turns on italic style for this text (not well supported by terminal emulators).
Source
# File lib/rainbow/presenter.rb, line 117 def method_missing(method_name, *args) if Color::X11Named.color_names.include?(method_name) && args.empty? color(method_name) else super end end
We take care of X11 color method call here. Such as aqua, ghostwhite.
Calls superclass method
Source
# File lib/rainbow/presenter.rb, line 37 def reset wrap_with_sgr(TERM_EFFECTS[:reset]) end
Resets terminal to default colors/backgrounds.
It shouldn’t be needed to use this method because all methods append terminal reset code to end of string.
Source
# File lib/rainbow/presenter.rb, line 125 def respond_to_missing?(method_name, *args) Color::X11Named.color_names.include?(method_name) && args.empty? || super end
Calls superclass method
Source
# File lib/rainbow/presenter.rb, line 63 def underline wrap_with_sgr(TERM_EFFECTS[:underline]) end
Turns on underline decoration for this text.