Class: Kraaken::Logger::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/kraaken/logger/color.rb

Constant Summary collapse

CLEAR =
"\e[0m"
BOLD =
"\e[1m"
BLACK =

Colors

"\e[30m"
RED =
"\e[31m"
GREEN =
"\e[32m"
YELLOW =
"\e[33m"
BLUE =
"\e[34m"
MAGENTA =
"\e[35m"
CYAN =
"\e[36m"
WHITE =
"\e[37m"
GRAY =
"\e[90m"

Instance Method Summary collapse

Instance Method Details

#color(text, color:, bold: false) ⇒ Object



18
19
20
21
22
# File 'lib/kraaken/logger/color.rb', line 18

def color(text, color:, bold: false)
  color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol)
  bold = bold ? BOLD : ""
  "#{bold}#{color}#{text}#{CLEAR}"
end