Last active
September 28, 2016 16:48
-
-
Save natebird/33296e191d00ab05aae9 to your computer and use it in GitHub Desktop.
Creating Color Constants by Extending UIColor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SomeClass { | |
var fancyColor = UIColor.customDarkGreen() | |
var superFancyColor = UIColor.customLightGreen() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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