#to_color ⇒ Object

# File 'motion/core/string.rb', line 63defto_color# First check if it is a color keywordkeyword_selector="#{self.camelize(:lower)}Color"color_klass=App.osx?? NSColor:UIColorreturncolor_klass.send(keyword_selector)ifcolor_klass.respond_to?keyword_selector# Next attempt to convert from hexhex_color=self.gsub("#","")casehex_color.sizewhen3colors=hex_color.scan(%r{[0-9A-Fa-f]}).map!{|el|(el*2).to_i(16)}when6colors=hex_color.scan(%r<[0-9A-Fa-f]{2}>).map!{|el|el.to_i(16)}when8colors=hex_color.scan(%r<[0-9A-Fa-f]{2}>).map!{|el|el.to_i(16)}elseraiseArgumentErrorendifcolors.size==3BubbleWrap.rgb_color(colors[0],colors[1],colors[2])elsifcolors.size==4BubbleWrap.rgba_color(colors[1],colors[2],colors[3],colors[0])elseraiseArgumentErrorendend