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 29 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 85 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 71 def blink wrap_with_sgr(TERM_EFFECTS[:blink]) end
blue()
click to toggle source
# File lib/rainbow/presenter.rb, line 101 def blue color(:blue) end
bright()
click to toggle source
Turns on bright/bold for this text.
# File lib/rainbow/presenter.rb, line 44 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 21 def color(*values) wrap_with_sgr(Color.build(:foreground, values).codes) end
Also aliased as: foreground, fg
cyan()
click to toggle source
# File lib/rainbow/presenter.rb, line 109 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 52 def faint wrap_with_sgr(TERM_EFFECTS[:faint]) end
Also aliased as: dark
green()
click to toggle source
# File lib/rainbow/presenter.rb, line 93 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 81 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 76 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 60 def italic wrap_with_sgr(TERM_EFFECTS[:italic]) end
magenta()
click to toggle source
# File lib/rainbow/presenter.rb, line 105 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 119 def method_missing(method_name,*args) if Color::X11Named.color_names.include? method_name and args.empty? then color(method_name) else super end end
red()
click to toggle source
# File lib/rainbow/presenter.rb, line 89 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 39 def reset wrap_with_sgr(TERM_EFFECTS[:reset]) end
underline()
click to toggle source
Turns on underline decoration for this text.
# File lib/rainbow/presenter.rb, line 65 def underline wrap_with_sgr(TERM_EFFECTS[:underline]) end
white()
click to toggle source
# File lib/rainbow/presenter.rb, line 113 def white color(:white) end
yellow()
click to toggle source
# File lib/rainbow/presenter.rb, line 97 def yellow color(:yellow) end