Created
July 27, 2016 21:04
-
-
Save JoeFerrucci/89a1dc5bbeaae57d607a56ddefa86a68 to your computer and use it in GitHub Desktop.
Easy UIColors using hex values, no more slower string manipulation.
This file contains 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
extension UIColor { | |
convenience init(hex: Int) { | |
self.init(red: CGFloat((hex & 0xFF0000) >> 16) / 255.0, | |
green: CGFloat((hex & 0x00FF00) >> 8) / 255.0, | |
blue: CGFloat(hex & 0x0000FF) / 255.0, | |
alpha: 1.0) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment