Sha256: 112b01415ad06af9b9c00c6c589d1687bfce616decf1590297e62573124ef0cc

Contents?: true

Size: 297 Bytes

Versions: 25

Compression:

Stored size: 297 Bytes

Contents

class NSArray

  # [160, 210, 242].uicolor => 0xA0D2F2.uicolor
  def uicolor(alpha=1.0)
    red = self[0] / 255.0
    green = self[1] / 255.0
    blue = self[2] / 255.0
    if self[3]
      alpha = self[3]
    end
    UIColor.colorWithRed(red, green:green, blue:blue, alpha:alpha.to_f)
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
sugarcube-1.5.9 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.8 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.7 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.6 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.5 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.4 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.3 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.2 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.1 lib/sugarcube-color/nsarray.rb
sugarcube-1.5.0 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.6 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.5 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.4 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.3 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.2 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.1 lib/sugarcube-color/nsarray.rb
sugarcube-1.4.0 lib/sugarcube-color/nsarray.rb
sugarcube-1.3.11 lib/sugarcube-color/nsarray.rb
sugarcube-1.3.10 lib/sugarcube-color/nsarray.rb
sugarcube-1.3.9 lib/sugarcube-color/nsarray.rb