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
271 272 273 |
# File 'lib/tui.rb', line 271 def accent(text) wrap(text, Palette::ACCENT, ANSI::RESET_FG + ANSI::RESET_INTENSITY) end |
.bold(text) ⇒ Object
259 260 261 |
# File 'lib/tui.rb', line 259 def bold(text) wrap(text, ANSI::BOLD, ANSI::RESET_INTENSITY) end |
.dim(text) ⇒ Object
263 264 265 |
# File 'lib/tui.rb', line 263 def dim(text) wrap(text, Palette::MUTED, ANSI::RESET_FG) end |
.highlight(text) ⇒ Object
267 268 269 |
# File 'lib/tui.rb', line 267 def highlight(text) wrap(text, Palette::HIGHLIGHT, ANSI::RESET_FG + ANSI::RESET_INTENSITY) end |
.wrap(text, prefix, suffix) ⇒ Object
275 276 277 278 279 |
# File 'lib/tui.rb', line 275 def wrap(text, prefix, suffix) return "" if text.nil? || text.empty? return text unless Tui.colors_enabled? "#{prefix}#{text}#{suffix}" end |