We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
You can add an extension :
extension UIColor { func rgb() -> Int? { var fRed : CGFloat = 0 var fGreen : CGFloat = 0 var fBlue : CGFloat = 0 var fAlpha: CGFloat = 0 if self.getRed(&fRed, green: &fGreen, blue: &fBlue, alpha: &fAlpha) { let iRed = Int(fRed * 255.0) let iGreen = Int(fGreen * 255.0) let iBlue = Int(fBlue * 255.0) let iAlpha = Int(fAlpha * 255.0) // (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue). let rgb = (iAlpha << 24) + (iRed << 16) + (iGreen << 8) + iBlue return rgb } else { // Could not extract RGBA components: return nil } } }
And then just call it:
colorPicker.color.rgb() // will return somthing like 0xDBDDE0
Sorry, something went wrong.
Thanks @Que20 will try out this.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: