Module: Vedeu::EscapeSequences::Background

Extended by:
Forwardable, Background
Included in:
Background, Esc
Defined in:
lib/vedeu/esc/background.rb

Overview

Provides background colour related escape sequences.

See esc

Instance Method Summary collapse

Instance Method Details

#background(sequence, &block) ⇒ String (private)

Parameters:

  • sequence (String)

    The colour escape sequence.

  • block (Proc)

Returns:

  • (String)


125
126
127
128
129
130
131
132
133
# File 'lib/vedeu/esc/background.rb', line 125

def background(sequence, &block)
  if block_given?
    sequence + yield + bg_reset

  else
    sequence

  end
end

#on_black(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


20
21
22
# File 'lib/vedeu/esc/background.rb', line 20

def on_black(&block)
  background("\e[40m", &block)
end

#on_blue(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


44
45
46
# File 'lib/vedeu/esc/background.rb', line 44

def on_blue(&block)
  background("\e[44m", &block)
end

#on_cyan(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


56
57
58
# File 'lib/vedeu/esc/background.rb', line 56

def on_cyan(&block)
  background("\e[46m", &block)
end

#on_dark_grey(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


74
75
76
# File 'lib/vedeu/esc/background.rb', line 74

def on_dark_grey(&block)
  background("\e[100m", &block)
end

#on_default(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


68
69
70
# File 'lib/vedeu/esc/background.rb', line 68

def on_default(&block)
  background(bg_reset, &block)
end

#on_green(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


32
33
34
# File 'lib/vedeu/esc/background.rb', line 32

def on_green(&block)
  background("\e[42m", &block)
end

#on_light_blue(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


98
99
100
# File 'lib/vedeu/esc/background.rb', line 98

def on_light_blue(&block)
  background("\e[104m", &block)
end

#on_light_cyan(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


110
111
112
# File 'lib/vedeu/esc/background.rb', line 110

def on_light_cyan(&block)
  background("\e[106m", &block)
end

#on_light_green(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


86
87
88
# File 'lib/vedeu/esc/background.rb', line 86

def on_light_green(&block)
  background("\e[102m", &block)
end

#on_light_grey(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


62
63
64
# File 'lib/vedeu/esc/background.rb', line 62

def on_light_grey(&block)
  background("\e[47m", &block)
end

#on_light_magenta(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


104
105
106
# File 'lib/vedeu/esc/background.rb', line 104

def on_light_magenta(&block)
  background("\e[105m", &block)
end

#on_light_red(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


80
81
82
# File 'lib/vedeu/esc/background.rb', line 80

def on_light_red(&block)
  background("\e[101m", &block)
end

#on_light_yellow(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


92
93
94
# File 'lib/vedeu/esc/background.rb', line 92

def on_light_yellow(&block)
  background("\e[103m", &block)
end

#on_magenta(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


50
51
52
# File 'lib/vedeu/esc/background.rb', line 50

def on_magenta(&block)
  background("\e[45m", &block)
end

#on_red(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


26
27
28
# File 'lib/vedeu/esc/background.rb', line 26

def on_red(&block)
  background("\e[41m", &block)
end

#on_white(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


116
117
118
# File 'lib/vedeu/esc/background.rb', line 116

def on_white(&block)
  background("\e[107m", &block)
end

#on_yellow(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


38
39
40
# File 'lib/vedeu/esc/background.rb', line 38

def on_yellow(&block)
  background("\e[43m", &block)
end