Module: Bk::Color

Included in:
AnnotationFormatter::Markdown, Bk::Commands::Base
Defined in:
lib/bk/color.rb

Instance Method Summary collapse

Instance Method Details

#colorize(text, color) ⇒ Object



23
24
25
# File 'lib/bk/color.rb', line 23

def colorize(text, color)
  is_tty? ? color.call(text) : text
end

#create_color_hash(mappings = {}) ⇒ Object



27
28
29
30
# File 'lib/bk/color.rb', line 27

def create_color_hash(mappings = {})
  hash = Hash.new(default_color)
  hash.merge!(mappings)
end

#default_colorObject



19
20
21
# File 'lib/bk/color.rb', line 19

def default_color
  @default_color ||= pastel.white.detach
end

#error_colorObject



7
8
9
# File 'lib/bk/color.rb', line 7

def error_color
  @error_color ||= pastel.red.detach
end

#info_colorObject



15
16
17
# File 'lib/bk/color.rb', line 15

def info_color
  @info_color ||= pastel.blue.detach
end

#success_colorObject



3
4
5
# File 'lib/bk/color.rb', line 3

def success_color
  @success_color ||= pastel.green.detach
end

#warning_colorObject



11
12
13
# File 'lib/bk/color.rb', line 11

def warning_color
  @warning_color ||= pastel.yellow.detach
end