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



9
10
11
12
13
14
15
16
17
# File 'lib/eclair/color.rb', line 9

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



5
6
7
# File 'lib/eclair/color.rb', line 5

def storage
  @storage ||= {}
end