Created
April 26, 2017 22:26
-
-
Save acrookston/cd3283ddaa94148029ff030223bc711e to your computer and use it in GitHub Desktop.
UIColor extension for creating UIColor with rgba() values
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
import UIKit | |
extension UIColor { | |
static func rgba(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat, _ a: CGFloat) -> UIColor { | |
return UIColor(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: a) | |
} | |
static var lightBackground: UIColor { return .rgba(246, 246, 246, 1) } | |
static var text: UIColor { return .rgba(51, 51, 51, 1) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment