Module: Eclair::Color

Extended by:
Color
Included in:
Color
Defined in:
lib/eclair/color.rb

Instance Method Summary collapse

Instance Method Details

#fetch(fg, bg, options = 0) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/eclair/color.rb', line 12

def fetch fg, bg, options = 0
  @idx ||= 1
  unless storage[[fg,bg]]
    Curses.init_pair(@idx, fg, bg)
    storage[[fg,bg]] = @idx
    @idx += 1
  end
  Curses.color_pair(storage[[fg,bg]]) | options
end

#storageObject



8
9
10
# File 'lib/eclair/color.rb', line 8

def storage
  @storage ||= {}
end