Created
September 14, 2016 16:21
-
-
Save rickyngan/d5df45c115927d15f9ced5fd8f708ea0 to your computer and use it in GitHub Desktop.
UIColor hex
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(rgb: UInt) { | |
self.init( | |
red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, | |
green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0, | |
blue: CGFloat(rgb & 0x0000FF) / 255.0, | |
alpha: CGFloat(1.0) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment