Module: Tui::Text
- Defined in:
- lib/tui.rb
Class Method Summary collapse
- .accent(text) ⇒ Object
- .bold(text) ⇒ Object
- .dim(text) ⇒ Object
- .highlight(text) ⇒ Object
- .wrap(text, prefix, suffix) ⇒ Object
Class Method Details
.accent(text) ⇒ Object
260 261 262 |
# File 'lib/tui.rb', line 260 def accent(text) wrap(text, Palette::ACCENT, ANSI::RESET_FG + ANSI::RESET_INTENSITY) end |
.bold(text) ⇒ Object
248 249 250 |
# File 'lib/tui.rb', line 248 def bold(text) wrap(text, ANSI::BOLD, ANSI::RESET_INTENSITY) end |
.dim(text) ⇒ Object
252 253 254 |
# File 'lib/tui.rb', line 252 def dim(text) wrap(text, Palette::MUTED, ANSI::RESET_FG) end |
.highlight(text) ⇒ Object
256 257 258 |
# File 'lib/tui.rb', line 256 def highlight(text) wrap(text, Palette::HIGHLIGHT, ANSI::RESET_FG + ANSI::RESET_INTENSITY) end |
.wrap(text, prefix, suffix) ⇒ Object
264 265 266 267 268 |
# File 'lib/tui.rb', line 264 def wrap(text, prefix, suffix) return "" if text.nil? || text.empty? return text unless Tui.colors_enabled? "#{prefix}#{text}#{suffix}" end |