Sha256: 15df5610c67ea65c2018ffc69d4622ab8f48f406bccc01b6e5b8d82571a8cfb3

Contents?: true

Size: 407 Bytes

Versions: 44

Compression:

Stored size: 407 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
    NSColor.colorWithRed(red, green:green, blue:blue, alpha:alpha.to_f)
  end

  def cgcolor(alpha=nil)
    nscolor(alpha).CGColor
  end

  def skcolor(alpha=nil)
    uicolor(alpha)
  end

end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
sugarcube-3.3.2 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.3.1 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.3.0 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.2.0 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.1.1 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.1.0 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.8 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.7 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.6 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.5 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.4 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.3 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.2 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.1 lib/osx/sugarcube-color/nsarray.rb
sugarcube-3.0.0 lib/osx/sugarcube-color/nsarray.rb
sugarcube-2.12.3 lib/osx/sugarcube-color/nsarray.rb
sugarcube-2.12.2 lib/osx/sugarcube-color/nsarray.rb
sugarcube-2.12.1 lib/osx/sugarcube-color/nsarray.rb
sugarcube-2.12.0 lib/osx/sugarcube-color/nsarray.rb
sugarcube-2.11.1 lib/osx/sugarcube-color/nsarray.rb