Class: RMQColor
- Defined in:
- lib/project/ruby_motion_query/rmq_color.rb
Class Method Summary collapse
- .add_named(key, hex_or_color) ⇒ Object
- .black ⇒ Object
- .clear ⇒ Object
- .dark_gray ⇒ Object
-
.from_hex(str) ⇒ UIColor
Creates a color from a hex triplet (rgb) or quartet (rgba).
- .from_rgba(r, g, b, a) ⇒ UIColor
- .gray ⇒ Object
- .light_gray ⇒ Object
- .method_missing(color_key) ⇒ Object
- .random ⇒ Object
- .rmq_color_cache ⇒ Object
- .transparent ⇒ Object
- .white ⇒ Object
Class Method Details
.add_named(key, hex_or_color) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 45 def add_named(key, hex_or_color) c = if hex_or_color.is_a?(String) RMQColor.parseColor(hex_or_color) else hex_or_color end rmq_color_cache[key] = c end |
.black ⇒ Object
28 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 28 def black ; self::BLACK ; end |
.clear ⇒ Object
21 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 21 def clear ; self::TRANSPARENT ; end |
.dark_gray ⇒ Object
27 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 27 def dark_gray ; self::DKGRAY ; end |
.from_hex(str) ⇒ UIColor
Creates a color from a hex triplet (rgb) or quartet (rgba)
69 70 71 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 69 def from_hex(str) RMQColorFactory.from_hex(str) end |
.from_rgba(r, g, b, a) ⇒ UIColor
77 78 79 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 77 def from_rgba(r,g,b,a) RMQColorFactory.from_rgba(r,g,b,a) end |
.gray ⇒ Object
26 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 26 def gray ; self::GRAY ; end |
.light_gray ⇒ Object
25 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 25 def light_gray ; self::LTGRAY ; end |
.method_missing(color_key) ⇒ Object
55 56 57 58 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 55 def method_missing(color_key) # define_singleton_method isn't implemented in Android :'( rmq_color_cache[color_key] end |
.random ⇒ Object
81 82 83 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 81 def random RMQColorFactory.from_rgba(rand(255), rand(255), rand(255), 1.0) end |
.rmq_color_cache ⇒ Object
85 86 87 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 85 def rmq_color_cache @_rmq_color_cache ||= {} end |
.transparent ⇒ Object
22 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 22 def transparent ; self::TRANSPARENT ; end |
.white ⇒ Object
24 |
# File 'lib/project/ruby_motion_query/rmq_color.rb', line 24 def white ; self::WHITE ; end |