Module: Vedeu::EscapeSequences::Background

Extended by:
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

#on_black(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


17
18
19
20
21
22
23
24
25
# File 'lib/vedeu/esc/background.rb', line 17

def on_black(&block)
  if block_given?
    "\e[40m" + yield + "\e[49m"

  else
    "\e[40m"

  end
end

#on_blue(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


65
66
67
68
69
70
71
72
73
# File 'lib/vedeu/esc/background.rb', line 65

def on_blue(&block)
  if block_given?
    "\e[44m" + yield + "\e[49m"

  else
    "\e[44m"

  end
end

#on_cyan(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


89
90
91
92
93
94
95
96
97
# File 'lib/vedeu/esc/background.rb', line 89

def on_cyan(&block)
  if block_given?
    "\e[46m" + yield + "\e[49m"

  else
    "\e[46m"

  end
end

#on_dark_grey(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


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

def on_dark_grey(&block)
  if block_given?
    "\e[100m" + yield + "\e[49m"

  else
    "\e[100m"

  end
end

#on_default(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


113
114
115
116
117
118
119
120
121
# File 'lib/vedeu/esc/background.rb', line 113

def on_default(&block)
  if block_given?
    "\e[49m" + yield + "\e[49m"

  else
    "\e[49m"

  end
end

#on_green(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


41
42
43
44
45
46
47
48
49
# File 'lib/vedeu/esc/background.rb', line 41

def on_green(&block)
  if block_given?
    "\e[42m" + yield + "\e[49m"

  else
    "\e[42m"

  end
end

#on_light_blue(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


173
174
175
176
177
178
179
180
181
# File 'lib/vedeu/esc/background.rb', line 173

def on_light_blue(&block)
  if block_given?
    "\e[104m" + yield + "\e[49m"

  else
    "\e[104m"

  end
end

#on_light_cyan(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


197
198
199
200
201
202
203
204
205
# File 'lib/vedeu/esc/background.rb', line 197

def on_light_cyan(&block)
  if block_given?
    "\e[106m" + yield + "\e[49m"

  else
    "\e[106m"

  end
end

#on_light_green(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


149
150
151
152
153
154
155
156
157
# File 'lib/vedeu/esc/background.rb', line 149

def on_light_green(&block)
  if block_given?
    "\e[102m" + yield + "\e[49m"

  else
    "\e[102m"

  end
end

#on_light_grey(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


101
102
103
104
105
106
107
108
109
# File 'lib/vedeu/esc/background.rb', line 101

def on_light_grey(&block)
  if block_given?
    "\e[47m" + yield + "\e[49m"

  else
    "\e[47m"

  end
end

#on_light_magenta(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


185
186
187
188
189
190
191
192
193
# File 'lib/vedeu/esc/background.rb', line 185

def on_light_magenta(&block)
  if block_given?
    "\e[105m" + yield + "\e[49m"

  else
    "\e[105m"

  end
end

#on_light_red(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


137
138
139
140
141
142
143
144
145
# File 'lib/vedeu/esc/background.rb', line 137

def on_light_red(&block)
  if block_given?
    "\e[101m" + yield + "\e[49m"

  else
    "\e[101m"

  end
end

#on_light_yellow(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


161
162
163
164
165
166
167
168
169
# File 'lib/vedeu/esc/background.rb', line 161

def on_light_yellow(&block)
  if block_given?
    "\e[103m" + yield + "\e[49m"

  else
    "\e[103m"

  end
end

#on_magenta(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


77
78
79
80
81
82
83
84
85
# File 'lib/vedeu/esc/background.rb', line 77

def on_magenta(&block)
  if block_given?
    "\e[45m" + yield + "\e[49m"

  else
    "\e[45m"

  end
end

#on_red(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


29
30
31
32
33
34
35
36
37
# File 'lib/vedeu/esc/background.rb', line 29

def on_red(&block)
  if block_given?
    "\e[41m" + yield + "\e[49m"

  else
    "\e[41m"

  end
end

#on_white(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


209
210
211
212
213
214
215
216
217
# File 'lib/vedeu/esc/background.rb', line 209

def on_white(&block)
  if block_given?
    "\e[107m" + yield + "\e[49m"

  else
    "\e[107m"

  end
end

#on_yellow(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


53
54
55
56
57
58
59
60
61
# File 'lib/vedeu/esc/background.rb', line 53

def on_yellow(&block)
  if block_given?
    "\e[43m" + yield + "\e[49m"

  else
    "\e[43m"

  end
end