Skip to content

Instantly share code, notes, and snippets.

@natebird natebird/SomeClass.swift
Last active Sep 28, 2016

Embed
What would you like to do?
Creating Color Constants by Extending UIColor
class SomeClass {
var fancyColor = UIColor.customDarkGreen()
var superFancyColor = UIColor.customLightGreen()
}
import UIKit
extension UIColor {
class func customDarkGreen() -> UIColor {
return UIColor(red: 0, green: 108/255, blue: 86/255, alpha: 1)
}
class func customLightGreen() -> UIColor {
return UIColor(red: 0, green: 175/255, blue: 158/255, alpha: 1)
}
class func customDarkGray() -> UIColor {
return UIColor(red: 95/255, green: 106/255, blue: 114/255, alpha: 1)
}
class func customWarmGray() -> UIColor {
return UIColor(red: 233/255, green: 227/255, blue: 219/255, alpha: 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.