Module: Chromate

Defined in:
lib/chromate/hex.rb,
lib/chromate/lab.rb,
lib/chromate/rgb.rb,
lib/chromate/cache.rb,
lib/chromate/color.rb,
lib/chromate/effect.rb,
lib/chromate/effects.rb,
lib/chromate/version.rb,
lib/chromate/effect_set.rb,
lib/chromate/formattable.rb

Defined Under Namespace

Modules: Formattable, Hex, Lab, RGB Classes: Color, Effect, EffectSet

Constant Summary collapse

CACHE =

A cache mapping RGB arrays to their Color representations

{}
EFFECTS =

Commonly supported effect sequences

{
  :off       => Effect.new(0),
  :bold      => Effect.new(1),
  :underline => Effect.new(4),
  :blink     => Effect.new(5),
  :negative  => Effect.new(7)
}
VALID_EFFECTS =

Valid effect sequences

EFFECTS.map { |n, e| e.to_i }
OFF =
EFFECTS[:off]
COLOR_NAMES =

Names for common colors

{
  :black        => 0,
  :dark_red     => 1,
  :dark_green   => 2,
  :dark_yellow  => 3,
  :dark_blue    => 4,
  :dark_magenta => 5,
  :dark_cyan    => 6,
  :silver       => 7,
  :gray         => 8,
  :grey         => 8,
  :red          => 9,
  :green        => 10,
  :yellow       => 11,
  :blue         => 12,
  :magenta      => 13,
  :cyan         => 14,
  :white        => 15
}
COLORS =

All xterm-256 colors

(0..255).map { |i| Color.new(i) }
GREYSCALE_COLORS =

Greyscale colors

COLORS[231..255] + 
[COLORS[0], COLORS[7], COLORS[8], COLORS[15]]
SUPPORTED_COLORS =

Colors supported by the host environment

case RbConfig::CONFIG['host_os']
when /darwin|linux|arch|solaris|sunos|(free|net|open)bsd/i
  COLORS[0..`tput colors`.to_i - 1]
when /mswin|windows/i
  begin
    require 'win32console'
    COLORS[0..15]
  rescue LoadError
    []
  end
else
  []
end
VERSION =
'1.0.0'