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
to curses constant.
Class Method Details
.index(color) ⇒ Object
15 16 17 |
# File 'lib/color.rb', line 15 def self.index(color) Colors.find_index(color) # "our" number end |
.pair(fg, bg) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/color.rb', line 19 def self.pair(fg, bg) nf, nb = index(fg), index(bg) num = 8*nf + nb X.init_pair(num, sym2const(fg), sym2const(bg)) num end |
.sym2const(color) ⇒ Object
to curses constant
11 12 13 |
# File 'lib/color.rb', line 11 def self.sym2const(color) # to curses constant X.const_get("COLOR_#{color.to_s.upcase}") end |