Sha256: 66e5470e4587a748cdbce09d19579f0125a0acdfe76a83098c8d85cf0432b3be
Contents?: true
Size: 487 Bytes
Versions: 63
Compression:
Stored size: 487 Bytes
Contents
class Fixnum # 0xffffff.uicolor # 0xffffff.uicolor(0.33) # => # UIColor.colorWithRed(1.0, green:1.0, blue: 1.0, alpha:1.0) # UIColor.colorWithRed(1.0, green:1.0, blue: 1.0, alpha:0.33) def uicolor(alpha=nil) alpha = 1.0 if alpha.nil? red = ((self & 0xFF0000) >> 16).to_f / 255.0 green = ((self & 0xFF00) >> 8).to_f / 255.0 blue = (self & 0xFF).to_f / 255.0 UIColor.colorWithRed(red, green:green, blue:blue, alpha:alpha.to_f) end end
Version data entries
63 entries across 63 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-0.7 | lib/sugarcube/fixnum.rb |
sugarcube-0.6.1 | lib/sugarcube/fixnum.rb |
sugarcube-0.6 | lib/sugarcube/fixnum.rb |