Module: Bk::Color
- Included in:
- AnnotationFormatter::Markdown, Bk::Commands::Base
- Defined in:
- lib/bk/color.rb
Instance Method Summary collapse
- #colorize(text, color) ⇒ Object
- #create_color_hash(mappings = {}) ⇒ Object
- #default_color ⇒ Object
- #error_color ⇒ Object
- #info_color ⇒ Object
- #success_color ⇒ Object
- #warning_color ⇒ Object
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_color ⇒ Object
19 20 21 |
# File 'lib/bk/color.rb', line 19 def default_color @default_color ||= pastel.white.detach end |
#error_color ⇒ Object
7 8 9 |
# File 'lib/bk/color.rb', line 7 def error_color @error_color ||= pastel.red.detach end |
#info_color ⇒ Object
15 16 17 |
# File 'lib/bk/color.rb', line 15 def info_color @info_color ||= pastel.blue.detach end |
#success_color ⇒ Object
3 4 5 |
# File 'lib/bk/color.rb', line 3 def success_color @success_color ||= pastel.green.detach end |
#warning_color ⇒ Object
11 12 13 |
# File 'lib/bk/color.rb', line 11 def warning_color @warning_color ||= pastel.yellow.detach end |