Class: RubyText::Color
- Inherits:
-
Object
- Object
- RubyText::Color
- Defined in:
- lib/color.rb
Constant Summary collapse
- Colors =
::Colors
Class Method Summary collapse
- .index(color) ⇒ Object
- .pair(fg, bg) ⇒ Object
-
.sym2const(color) ⇒ Object
FIXME some should be private TODO add color-pair constants.
Class Method Details
.index(color) ⇒ Object
18 19 20 |
# File 'lib/color.rb', line 18 def self.index(color) Colors.find_index(color) # "our" number end |
.pair(fg, bg) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/color.rb', line 22 def self.pair(fg, bg) nf, nb = index(fg), index(bg) num = 8*nf + nb Curses.init_pair(num, sym2const(fg), sym2const(bg)) num end |
.sym2const(color) ⇒ Object
FIXME some should be private TODO add color-pair constants
14 15 16 |
# File 'lib/color.rb', line 14 def self.sym2const(color) # to curses constant Curses.const_get("COLOR_#{color.to_s.upcase}") end |