daytonn
6/23/2013 - 12:56 AM

Properly Namespaced UIColor helper

Properly Namespaced UIColor helper

module UIColor

  def self.black
    UIColor.blackColor
  end

  def self.darkGray
    UIColor.darkGrayColor
  end

  def self.darkGrey
    UIColor.darkGrayColor
  end

  def self.lightGray
    UIColor.lightGrayColor
  end

  def self.lightGrey
    UIColor.lightGrayColor
  end

  def self.white
    UIColor.whiteColor
  end

  def self.gray
    UIColor.grayColor
  end

  def self.grey
    UIColor.grayColor
  end

  def self.red
    UIColor.redColor
  end

  def self.green
    UIColor.greenColor
  end

  def self.blue
    UIColor.blueColor
  end

  def self.cyan
    UIColor.cyanColor
  end

  def self.yellow
    UIColor.yellowColor
  end

  def self.magenta
    UIColor.magentaColor
  end

  def self.orange
    UIColor.orangeColor
  end

  def self.purple
    UIColor.purpleColor
  end

  def self.brown
    UIColor.brownColor
  end

  def self.clear
    UIColor.clearColor
  end

  def self.lightText
    UIColor.lightTextColor
  end

  def self.darkText
    UIColor.darkTextColor
  end

  def self.rgb(r, g, b, a=100)
    UIColor.alloc.initWithRed(Float(r), green: Float(g), blue: Float(b), alpha: Float(a))
  end

  def self.rgba(r, g, b, a)
    UIColor.alloc.initWithRed(Float(r), green: Float(g), blue: Float(b), alpha: Float(a))
  end

end