Method: NSArray#nscolor

Defined in:
lib/osx/sugarcube-color/nsarray.rb

#nscolor(alpha = 1.0) ⇒ Object

[160, 210, 242].nscolor => 0xA0D2F2.nscolor



4
5
6
7
8
9
10
11
12
# File 'lib/osx/sugarcube-color/nsarray.rb', line 4

def nscolor(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.rgba(red, green, blue, alpha.to_f)
end