Sha256: 2e455f21f71879924f74a704adde9263301f107d6dd4bb72f30fe8ed75ec3c90

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

module Mack
  module Utils # :nodoc:
    module Ansi # :nodoc:
      
      module Color
        
        def self.wrap(color, string)
          if configatron.mack.log.use_colors
            return "\e[#{[Mack::Utils::Ansi::ColorRegistry.registered_items[color.to_sym] || 0].flatten.first}m#{string}\e[0m"
          end
          return string
        end
        
      end # Color
      
      class ColorRegistry < Mack::Utils::RegistryMap
        def initial_state
          { :blue => 34, :black => 30, :red => 31, :green => 32, :yellow => 33, :magenta => 35,
            :purple => 35, :cyan => 36, :white => 37, :clear => 0 }
        end
      end
      
    end # Ansi
  end # Utils
end # Mack

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mack-0.8.3 lib/mack/utils/ansi/ansi_color.rb
mack-0.8.3.1 lib/mack/utils/ansi/ansi_color.rb