Class: RubyXL::Color

Inherits:
OOXMLObject show all
Includes:
ColorConvenienceMethods
Defined in:
lib/rubyXL/objects/color.rb

Overview

Constant Summary collapse

COLOR_REGEXP =
/\A([a-f]|[A-F]|[0-9]){6}\Z/

Instance Attribute Summary

Attributes included from OOXMLObjectInstanceMethods

#local_namespaces

Class Method Summary collapse

Methods included from ColorConvenienceMethods

#get_rgb

Methods included from OOXMLObjectInstanceMethods

#==, #before_write_xml, included, #index_in_collection, #initialize, #write_xml

Class Method Details

.validate_color(color) ⇒ Object

validates hex color code, no ‘#’ allowed



17
18
19
20
21
22
23
# File 'lib/rubyXL/objects/color.rb', line 17

def self.validate_color(color)
  if color =~ COLOR_REGEXP
    return true
  else
    raise 'invalid color'
  end
end