Class: Blight::UsesColors

Inherits:
Object
  • Object
show all
Defined in:
lib/blight.rb

Instance Method Summary collapse

Constructor Details

#initialize(window) ⇒ UsesColors

Returns a new instance of UsesColors.



93
94
95
# File 'lib/blight.rb', line 93

def initialize(window)
  @window = window
end

Instance Method Details

#use(foreground, background) ⇒ Object



97
98
99
100
101
102
# File 'lib/blight.rb', line 97

def use(foreground, background)
  Ncurses.init_pair(1, find(foreground), find(background))
  Ncurses.attron(Ncurses.COLOR_PAIR(1))
  yield
  Ncurses.attroff(Ncurses.COLOR_PAIR(1))
end