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 27
def background(*values)
  wrap_with_sgr(Color.build(:background, values).codes)
end
Also aliased as: bg
bg(*values)
Alias for: background
black() click to toggle source
# File lib/rainbow/presenter.rb, line 73
def black
  color(:black)
end
blue() click to toggle source
# File lib/rainbow/presenter.rb, line 89
def blue
  color(:blue)
end
bright() click to toggle source

Turns on bright/bold for this text.

# File lib/rainbow/presenter.rb, line 42
def bright
  wrap_with_sgr(TERM_EFFECTS[:bright])
end
color(*values) click to toggle source

Sets color of this text.

# File lib/rainbow/presenter.rb, line 19
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 97
def cyan
  color(:cyan)
end
fg(*values)
Alias for: color
foreground(*values)
Alias for: color
green() click to toggle source
# File lib/rainbow/presenter.rb, line 81
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 69
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 64
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 48
def italic
  wrap_with_sgr(TERM_EFFECTS[:italic])
end
magenta() click to toggle source
# File lib/rainbow/presenter.rb, line 93
def magenta
  color(:magenta)
end
red() click to toggle source
# File lib/rainbow/presenter.rb, line 77
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 37
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 53
def underline
  wrap_with_sgr(TERM_EFFECTS[:underline])
end
white() click to toggle source
# File lib/rainbow/presenter.rb, line 101
def white
  color(:white)
end
yellow() click to toggle source
# File lib/rainbow/presenter.rb, line 85
def yellow
  color(:yellow)
end