Skip to content

Instantly share code, notes, and snippets.

@daytonn
Created June 23, 2013 00:56
Show Gist options
  • Save daytonn/5843293 to your computer and use it in GitHub Desktop.
Save daytonn/5843293 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment