Sha256: 2cecbc7fc914790acff34870192aa5e36f4e5ecdb52088a6f027ebc748b2d813

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 Bytes

Contents

require 'rubyXL/objects/ooxml_object'

module RubyXL

  # http://www.schemacentral.com/sc/ooxml/e-ssml_color-4.html
  class Color < OOXMLObject
    define_attribute(:auto,    :bool)
    define_attribute(:indexed, :int)
    define_attribute(:rgb,     :string)
    define_attribute(:theme,   :int)
    define_attribute(:tint,    :float)
    define_element_name 'color'

    #validates hex color code, no '#' allowed
    def self.validate_color(color)
      if color =~ /\A([a-f]|[A-F]|[0-9]){6}\Z/
        return true
      else
        raise 'invalid color'
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubyXL-3.0.1 lib/rubyXL/objects/color.rb
rubyXL-3.0.0 lib/rubyXL/objects/color.rb