Sha256: 90dd9773b5786fc298f633d272cc97ddb6f73e2edf3b4b68ff10328e299127c7
Contents?: true
Size: 530 Bytes
Versions: 10
Compression:
Stored size: 530 Bytes
Contents
class Fixnum # 0xffffff.uicolor # 0xffffff.uicolor(0.33) # => # UIColor.colorWithRed(1.0, green:1.0, red: 1.0, alpha:1.0) # UIColor.colorWithRed(1.0, green:1.0, red: 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 def percent self.to_f.percent end end
Version data entries
10 entries across 10 versions & 1 rubygems