Class: RMQColorFactory
- Defined in:
- lib/project/ruby_motion_query/rmq_color.rb
Class Method Summary collapse
-
.build(params, dummy = nil) ⇒ Object
Dummy works around RM bug.
- .from_hex(hex_string) ⇒ Object
- .from_rgba(r, g, b, a) ⇒ Object
Class Method Details
.build(params, dummy = nil) ⇒ Object
Dummy works around RM bug
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 95 def build(params, dummy=nil) # Dummy works around RM bug return RMQColor if params.empty? return from_rgba(*params) if params.count > 1 param = params.first return from_hex(params.join) if param.is_a?(String) #return from_base_color(param) if base_values(param) #return try_rgba(param) if rgba_values(param) #return try_hsva(param) if hsva_values(param) #return try_hex(param) if hex_values(param) end |
.from_hex(hex_string) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 108 def from_hex(hex_string) if hex_string.length == 7 # this is #RRGGBB format - we need to add the alpha color_str = "#FF#{hex_string[1..hex_string.length]}" end RMQColor.parseColor(hex_string) end |