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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.on_black(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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

  else
    "\e[43m"

  end
end

Instance Method Details

#on_black(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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

  else
    "\e[43m"

  end
end