Sha256: 04e2d6386d2a7c329567650b48948c9ebf65f5f0ded5f58757334a2ded774756

Contents?: true

Size: 363 Bytes

Versions: 1

Compression:

Stored size: 363 Bytes

Contents

require 'color/name'
require 'color/hex'

module Color
  def self.parse(value)
    if value =~ /^\#{0,1}[a-f0-9]{6}$/i
      Color.hex(value)
    elsif value.is_a?(Array)
      # TODO: Validate RGB color array
      value
    elsif Color::NAMES.has_key?(value.downcase.to_sym)
      Color.name(value)
    else
      raise "Unknown color format"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blink_stick-0.1.1 lib/color.rb