Module: RubyJard::Commands::ColorHelpers

Included in:
ColorSchemeCommand, FilterCommand
Defined in:
lib/ruby_jard/commands/color_helpers.rb

Overview

Helper to dedocrate command output

Instance Method Summary collapse

Instance Method Details

#color_decoratorObject



27
28
29
# File 'lib/ruby_jard/commands/color_helpers.rb', line 27

def color_decorator
  @color_decorator ||= RubyJard::Decorators::ColorDecorator.new(pick_color_scheme)
end

#highlight(content) ⇒ Object



16
17
18
# File 'lib/ruby_jard/commands/color_helpers.rb', line 16

def highlight(content)
  color_decorator.decorate(:text_highlighted, content)
end

#pick_color_schemeObject



20
21
22
23
24
25
# File 'lib/ruby_jard/commands/color_helpers.rb', line 20

def pick_color_scheme
  (
    RubyJard::ColorSchemes[RubyJard.config.color_scheme] ||
    RubyJard::ColorSchemes[RubyJard::Config::DEFAULT_COLOR_SCHEME]
  ).new
end

#secondary(content) ⇒ Object



12
13
14
# File 'lib/ruby_jard/commands/color_helpers.rb', line 12

def secondary(content)
  color_decorator.decorate(:text_primary, content)
end

#special(content) ⇒ Object



8
9
10
# File 'lib/ruby_jard/commands/color_helpers.rb', line 8

def special(content)
  color_decorator.decorate(:text_special, content)
end