Module: Wirble::Colorize::Color

Defined in:
lib/wirble.rb

Overview

Terminal escape codes for colors.

Constant Summary collapse

COLORS =
{
  :nothing      => '0;0',
  :black        => '0;30',
  :red          => '0;31',
  :green        => '0;32',
  :brown        => '0;33',
  :blue         => '0;34',
  :cyan         => '0;36',
  :purple       => '0;35',
  :light_gray   => '0;37',
  :dark_gray    => '1;30',
  :light_red    => '1;31',
  :light_green  => '1;32',
  :yellow       => '1;33',
  :light_blue   => '1;34',
  :light_cyan   => '1;36',
  :light_purple => '1;35',
  :white        => '1;37',
}

Class Method Summary collapse

Class Method Details

.escape(key) ⇒ Object

Return the escape code for a given color.



318
319
320
# File 'lib/wirble.rb', line 318

def self.escape(key)
  COLORS.key?(key) && "\033[#{COLORS[key]}m"
end