Method: UIColor#invert

Defined in:
lib/sugarcube-color/uicolor.rb

#invertObject

inverts the RGB channel. keeps the alpha channel unchanged

Examples:

:white.uicolor.invert == :black.uicolor


77
78
79
80
81
82
83
# File 'lib/sugarcube-color/uicolor.rb', line 77

def invert
  r = 1.0 - self.red
  g = 1.0 - self.green
  b = 1.0 - self.blue
  a = self.alpha
  UIColor.colorWithRed(r, green:g, blue:b, alpha:a)
end