Class: Curses::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/twterm/extensions/curses/window.rb

Instance Method Summary collapse

Instance Method Details

#bold(&block) ⇒ Object



2
3
4
5
6
# File 'lib/twterm/extensions/curses/window.rb', line 2

def bold(&block)
  attron(Curses::A_BOLD)
  block.call
  attroff(Curses::A_BOLD)
end

#with_color(fg, bg = :transparent, &block) ⇒ Object



8
9
10
11
12
13
# File 'lib/twterm/extensions/curses/window.rb', line 8

def with_color(fg, bg = :transparent, &block)
  color_pair_index = Twterm::ColorManager.instance.get_color_pair_index(fg, bg)
  attron(Curses.color_pair(color_pair_index))
  block.call
  attroff(Curses.color_pair(color_pair_index))
end