Sha256: 18652c6cf154cad992e3c4f3a1959bc17bc769aff4d0c142396566993e10d06d

Contents?: true

Size: 448 Bytes

Versions: 7

Compression:

Stored size: 448 Bytes

Contents

class Color < MotionResource::Base
  attr_accessor :hex
  
  has_many :tags
  
  scope :random, :url => 'json/colors/random/7'
  
  def ui_color
    pointer = Pointer.new(:uint)
    scanner = NSScanner.scannerWithString(self.hex)
    scanner.scanHexInt(pointer)
    rgbValue = pointer[0]
    return UIColor.colorWithRed(((rgbValue & 0xFF0000) >> 16)/255.0, green:((rgbValue & 0xFF00) >> 8)/255.0, blue:(rgbValue & 0xFF)/255.0, alpha:1.0)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
motion-resource-0.1.4 examples/Colr/app/color.rb
motion-resource-0.1.3 examples/Colr/app/color.rb
motion-resource-0.1.2 examples/Colr/app/color.rb
motion-resource-0.1.1 examples/Colr/app/color.rb
motion-resource-0.1.0 examples/Colr/app/color.rb
motion-resource-0.0.2 examples/Colr/app/color.rb
motion-resource-0.0.1 examples/Colr/app/color.rb