class Rainbow::Presenter
Constants
- TERM_EFFECTS
Public Instance Methods
background(*values)
click to toggle source
Sets background color of this text.
# File lib/rainbow/presenter.rb, line 30 def background(*values) wrap_with_sgr(Color.build(:background, values).codes) end
Also aliased as: bg
black()
click to toggle source
# File lib/rainbow/presenter.rb, line 92 def black color(:black) end
blink()
click to toggle source
Turns on blinking attribute for this text (not well supported by terminal emulators).
# File lib/rainbow/presenter.rb, line 72 def blink wrap_with_sgr(TERM_EFFECTS[:blink]) end
blue()
click to toggle source
# File lib/rainbow/presenter.rb, line 108 def blue color(:blue) end
bright()
click to toggle source
Turns on bright/bold for this text.
# File lib/rainbow/presenter.rb, line 45 def bright wrap_with_sgr(TERM_EFFECTS[:bright]) end
Also aliased as: bold
color(*values)
click to toggle source
Sets color of this text.
# File lib/rainbow/presenter.rb, line 22 def color(*values) wrap_with_sgr(Color.build(:foreground, values).codes) end
Also aliased as: foreground, fg
cross_out()
click to toggle source
# File lib/rainbow/presenter.rb, line 86 def cross_out wrap_with_sgr(TERM_EFFECTS[:cross_out]) end
Also aliased as: strike
cyan()
click to toggle source
# File lib/rainbow/presenter.rb, line 116 def cyan color(:cyan) end
faint()
click to toggle source
Turns on faint/dark for this text (not well supported by terminal emulators).
# File lib/rainbow/presenter.rb, line 53 def faint wrap_with_sgr(TERM_EFFECTS[:faint]) end
Also aliased as: dark
green()
click to toggle source
# File lib/rainbow/presenter.rb, line 100 def green color(:green) end
hide()
click to toggle source
Hides this text (set its color to the same as background).
# File lib/rainbow/presenter.rb, line 82 def hide wrap_with_sgr(TERM_EFFECTS[:hide]) end
inverse()
click to toggle source
Inverses current foreground/background colors.
# File lib/rainbow/presenter.rb, line 77 def inverse wrap_with_sgr(TERM_EFFECTS[:inverse]) end
italic()
click to toggle source
Turns on italic style for this text (not well supported by terminal emulators).
# File lib/rainbow/presenter.rb, line 61 def italic wrap_with_sgr(TERM_EFFECTS[:italic]) end
magenta()
click to toggle source
# File lib/rainbow/presenter.rb, line 112 def magenta color(:magenta) end
method_missing(method_name, *args)
click to toggle source
We take care of X11 color method call here. Such as aqua, ghostwhite.
Calls superclass method
# File lib/rainbow/presenter.rb, line 126 def method_missing(method_name, *args) if Color::X11Named.color_names.include?(method_name) && args.empty? color(method_name) else super end end
red()
click to toggle source
# File lib/rainbow/presenter.rb, line 96 def red color(:red) end
reset()
click to toggle source
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.
# File lib/rainbow/presenter.rb, line 40 def reset wrap_with_sgr(TERM_EFFECTS[:reset]) end
respond_to_missing?(method_name, *args)
click to toggle source
Calls superclass method
# File lib/rainbow/presenter.rb, line 134 def respond_to_missing?(method_name, *args) Color::X11Named.color_names.include?(method_name) && args.empty? || super end
underline()
click to toggle source
Turns on underline decoration for this text.
# File lib/rainbow/presenter.rb, line 66 def underline wrap_with_sgr(TERM_EFFECTS[:underline]) end
white()
click to toggle source
# File lib/rainbow/presenter.rb, line 120 def white color(:white) end
yellow()
click to toggle source
# File lib/rainbow/presenter.rb, line 104 def yellow color(:yellow) end