Module: Vedeu::EscapeSequences::Foreground
Overview
Provides foreground colour related escape sequences.
Class Method Summary collapse
- .black(&block) ⇒ String
- .blue(&block) ⇒ String
- .cyan(&block) ⇒ String
- .dark_grey(&block) ⇒ String
- .default(&block) ⇒ String
- .green(&block) ⇒ String
- .light_blue(&block) ⇒ String
- .light_cyan(&block) ⇒ String
- .light_green(&block) ⇒ String
- .light_grey(&block) ⇒ String
- .light_magenta(&block) ⇒ String
- .light_red(&block) ⇒ String
- .light_yellow(&block) ⇒ String
- .magenta(&block) ⇒ String
- .red(&block) ⇒ String
- .white(&block) ⇒ String
- .yellow(&block) ⇒ String
Instance Method Summary collapse
- #black(&block) ⇒ String
- #blue(&block) ⇒ String
- #cyan(&block) ⇒ String
- #dark_grey(&block) ⇒ String
- #default(&block) ⇒ String
- #green(&block) ⇒ String
- #light_blue(&block) ⇒ String
- #light_cyan(&block) ⇒ String
- #light_green(&block) ⇒ String
- #light_grey(&block) ⇒ String
- #light_magenta(&block) ⇒ String
- #light_red(&block) ⇒ String
- #light_yellow(&block) ⇒ String
- #magenta(&block) ⇒ String
- #red(&block) ⇒ String
- #white(&block) ⇒ String
- #yellow(&block) ⇒ String
Class Method Details
.black(&block) ⇒ String
15 16 17 18 19 20 21 22 23 |
# File 'lib/vedeu/esc/foreground.rb', line 15 def black(&block) if block_given? "\e[30m" + yield + "\e[39m" else "\e[30m" end end |
.blue(&block) ⇒ String
63 64 65 66 67 68 69 70 71 |
# File 'lib/vedeu/esc/foreground.rb', line 63 def blue(&block) if block_given? "\e[34m" + yield + "\e[39m" else "\e[34m" end end |
.cyan(&block) ⇒ String
87 88 89 90 91 92 93 94 95 |
# File 'lib/vedeu/esc/foreground.rb', line 87 def cyan(&block) if block_given? "\e[36m" + yield + "\e[39m" else "\e[36m" end end |
.dark_grey(&block) ⇒ String
123 124 125 126 127 128 129 130 131 |
# File 'lib/vedeu/esc/foreground.rb', line 123 def dark_grey(&block) if block_given? "\e[90m" + yield + "\e[39m" else "\e[90m" end end |
.default(&block) ⇒ String
111 112 113 114 115 116 117 118 119 |
# File 'lib/vedeu/esc/foreground.rb', line 111 def default(&block) if block_given? "\e[39m" + yield + "\e[39m" else "\e[39m" end end |
.green(&block) ⇒ String
39 40 41 42 43 44 45 46 47 |
# File 'lib/vedeu/esc/foreground.rb', line 39 def green(&block) if block_given? "\e[32m" + yield + "\e[39m" else "\e[32m" end end |
.light_blue(&block) ⇒ String
171 172 173 174 175 176 177 178 179 |
# File 'lib/vedeu/esc/foreground.rb', line 171 def light_blue(&block) if block_given? "\e[94m" + yield + "\e[39m" else "\e[94m" end end |
.light_cyan(&block) ⇒ String
195 196 197 198 199 200 201 202 203 |
# File 'lib/vedeu/esc/foreground.rb', line 195 def light_cyan(&block) if block_given? "\e[96m" + yield + "\e[39m" else "\e[96m" end end |
.light_green(&block) ⇒ String
147 148 149 150 151 152 153 154 155 |
# File 'lib/vedeu/esc/foreground.rb', line 147 def light_green(&block) if block_given? "\e[92m" + yield + "\e[39m" else "\e[92m" end end |
.light_grey(&block) ⇒ String
99 100 101 102 103 104 105 106 107 |
# File 'lib/vedeu/esc/foreground.rb', line 99 def light_grey(&block) if block_given? "\e[37m" + yield + "\e[39m" else "\e[37m" end end |
.light_magenta(&block) ⇒ String
183 184 185 186 187 188 189 190 191 |
# File 'lib/vedeu/esc/foreground.rb', line 183 def light_magenta(&block) if block_given? "\e[95m" + yield + "\e[39m" else "\e[95m" end end |
.light_red(&block) ⇒ String
135 136 137 138 139 140 141 142 143 |
# File 'lib/vedeu/esc/foreground.rb', line 135 def light_red(&block) if block_given? "\e[91m" + yield + "\e[39m" else "\e[91m" end end |
.light_yellow(&block) ⇒ String
159 160 161 162 163 164 165 166 167 |
# File 'lib/vedeu/esc/foreground.rb', line 159 def light_yellow(&block) if block_given? "\e[93m" + yield + "\e[39m" else "\e[93m" end end |
.magenta(&block) ⇒ String
75 76 77 78 79 80 81 82 83 |
# File 'lib/vedeu/esc/foreground.rb', line 75 def magenta(&block) if block_given? "\e[35m" + yield + "\e[39m" else "\e[35m" end end |
.red(&block) ⇒ String
27 28 29 30 31 32 33 34 35 |
# File 'lib/vedeu/esc/foreground.rb', line 27 def red(&block) if block_given? "\e[31m" + yield + "\e[39m" else "\e[31m" end end |
.white(&block) ⇒ String
207 208 209 210 211 212 213 214 215 |
# File 'lib/vedeu/esc/foreground.rb', line 207 def white(&block) if block_given? "\e[97m" + yield + "\e[39m" else "\e[97m" end end |
.yellow(&block) ⇒ String
51 52 53 54 55 56 57 58 59 |
# File 'lib/vedeu/esc/foreground.rb', line 51 def yellow(&block) if block_given? "\e[33m" + yield + "\e[39m" else "\e[33m" end end |
Instance Method Details
#black(&block) ⇒ String
15 16 17 18 19 20 21 22 23 |
# File 'lib/vedeu/esc/foreground.rb', line 15 def black(&block) if block_given? "\e[30m" + yield + "\e[39m" else "\e[30m" end end |
#blue(&block) ⇒ String
63 64 65 66 67 68 69 70 71 |
# File 'lib/vedeu/esc/foreground.rb', line 63 def blue(&block) if block_given? "\e[34m" + yield + "\e[39m" else "\e[34m" end end |
#cyan(&block) ⇒ String
87 88 89 90 91 92 93 94 95 |
# File 'lib/vedeu/esc/foreground.rb', line 87 def cyan(&block) if block_given? "\e[36m" + yield + "\e[39m" else "\e[36m" end end |
#dark_grey(&block) ⇒ String
123 124 125 126 127 128 129 130 131 |
# File 'lib/vedeu/esc/foreground.rb', line 123 def dark_grey(&block) if block_given? "\e[90m" + yield + "\e[39m" else "\e[90m" end end |
#default(&block) ⇒ String
111 112 113 114 115 116 117 118 119 |
# File 'lib/vedeu/esc/foreground.rb', line 111 def default(&block) if block_given? "\e[39m" + yield + "\e[39m" else "\e[39m" end end |
#green(&block) ⇒ String
39 40 41 42 43 44 45 46 47 |
# File 'lib/vedeu/esc/foreground.rb', line 39 def green(&block) if block_given? "\e[32m" + yield + "\e[39m" else "\e[32m" end end |
#light_blue(&block) ⇒ String
171 172 173 174 175 176 177 178 179 |
# File 'lib/vedeu/esc/foreground.rb', line 171 def light_blue(&block) if block_given? "\e[94m" + yield + "\e[39m" else "\e[94m" end end |
#light_cyan(&block) ⇒ String
195 196 197 198 199 200 201 202 203 |
# File 'lib/vedeu/esc/foreground.rb', line 195 def light_cyan(&block) if block_given? "\e[96m" + yield + "\e[39m" else "\e[96m" end end |
#light_green(&block) ⇒ String
147 148 149 150 151 152 153 154 155 |
# File 'lib/vedeu/esc/foreground.rb', line 147 def light_green(&block) if block_given? "\e[92m" + yield + "\e[39m" else "\e[92m" end end |
#light_grey(&block) ⇒ String
99 100 101 102 103 104 105 106 107 |
# File 'lib/vedeu/esc/foreground.rb', line 99 def light_grey(&block) if block_given? "\e[37m" + yield + "\e[39m" else "\e[37m" end end |
#light_magenta(&block) ⇒ String
183 184 185 186 187 188 189 190 191 |
# File 'lib/vedeu/esc/foreground.rb', line 183 def light_magenta(&block) if block_given? "\e[95m" + yield + "\e[39m" else "\e[95m" end end |
#light_red(&block) ⇒ String
135 136 137 138 139 140 141 142 143 |
# File 'lib/vedeu/esc/foreground.rb', line 135 def light_red(&block) if block_given? "\e[91m" + yield + "\e[39m" else "\e[91m" end end |
#light_yellow(&block) ⇒ String
159 160 161 162 163 164 165 166 167 |
# File 'lib/vedeu/esc/foreground.rb', line 159 def light_yellow(&block) if block_given? "\e[93m" + yield + "\e[39m" else "\e[93m" end end |
#magenta(&block) ⇒ String
75 76 77 78 79 80 81 82 83 |
# File 'lib/vedeu/esc/foreground.rb', line 75 def magenta(&block) if block_given? "\e[35m" + yield + "\e[39m" else "\e[35m" end end |
#red(&block) ⇒ String
27 28 29 30 31 32 33 34 35 |
# File 'lib/vedeu/esc/foreground.rb', line 27 def red(&block) if block_given? "\e[31m" + yield + "\e[39m" else "\e[31m" end end |
#white(&block) ⇒ String
207 208 209 210 211 212 213 214 215 |
# File 'lib/vedeu/esc/foreground.rb', line 207 def white(&block) if block_given? "\e[97m" + yield + "\e[39m" else "\e[97m" end end |
#yellow(&block) ⇒ String
51 52 53 54 55 56 57 58 59 |
# File 'lib/vedeu/esc/foreground.rb', line 51 def yellow(&block) if block_given? "\e[33m" + yield + "\e[39m" else "\e[33m" end end |