Method: Hanami::Utils::ShellColor.color_code

Defined in:
lib/hanami/utils/shell_color.rb

.color_code(code) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Helper method to translate between color names and terminal escape codes

Raises:

  • (Hanami::Utils::ShellColor::UnknownColorError)

    if the color code is unknown

Since:

  • 1.2.0



63
64
65
# File 'lib/hanami/utils/shell_color.rb', line 63

def self.color_code(code)
  COLORS.fetch(code) { raise UnknownColorCodeError.new(code) }
end