Class: Kafo::ColorScheme
- Inherits:
-
Object
- Object
- Kafo::ColorScheme
- Defined in:
- lib/kafo/color_scheme.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ColorScheme
constructor
A new instance of ColorScheme.
- #setup ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ColorScheme
Returns a new instance of ColorScheme.
10 11 12 13 |
# File 'lib/kafo/color_scheme.rb', line 10 def initialize(={}) @background = [:background].nil? ? :dark : [:background] @colors = [:colors].nil? ? self.class.colors_possible? : [:colors] end |
Class Method Details
.colors_possible? ⇒ Boolean
6 7 8 |
# File 'lib/kafo/color_scheme.rb', line 6 def self.colors_possible? ::ENV['TERM'] && !`which tput 2> /dev/null`.empty? && `tput colors`.to_i > 0 end |
Instance Method Details
#setup ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/kafo/color_scheme.rb', line 15 def setup HighLine.color_scheme = build_color_scheme if @colors HighLine.use_color = true else HighLine.use_color = false end end |