Sha256: c2c996b4cdeae4198da10764f231522c662e853b5212ced4c7fc2fea50b411b1

Contents?: true

Size: 420 Bytes

Versions: 4

Compression:

Stored size: 420 Bytes

Contents

module LogView
  module Colors
    COLOR_CODES = {
      green:      32,
      red:        31,
      blue:       34,
      yellow:     33,
      light_blue: 36,
      pink:       35
    }
    
    COLOR_CODES.each_pair do |color, code|
      define_method("paint_#{color}") { |string|
        paint code, string
      }
    end

    def paint color_code, string
      "\e[#{color_code}m#{string}\e[0m"
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
log_view-0.2.1 lib/log_view/colors.rb
log_view-0.2.0 lib/log_view/colors.rb
log_view-0.1.0 lib/log_view/colors.rb
log_view-0.0.1 lib/log_view/colors.rb