Created
October 15, 2016 09:22
-
-
Save bananafish911/61694613b9dfe90beb71bc99d4a5a80b to your computer and use it in GitHub Desktop.
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 { | |
/// Format: 0xFFAACC | |
convenience init(hex: Int) { | |
let components = ( | |
R: CGFloat((hex >> 16) & 0xff) / 255, | |
G: CGFloat((hex >> 08) & 0xff) / 255, | |
B: CGFloat((hex >> 00) & 0xff) / 255 | |
) | |
self.init(red: components.R, green: components.G, blue: components.B, alpha: 1) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment