Last active
April 22, 2020 08:24
-
-
Save mattrighetti/bc3b1794099cbf018b3d6504d117c14b to your computer and use it in GitHub Desktop.
UIColor extension
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 { | |
static let flatDarkBackground = UIColor(red: 36, green: 36, blue: 36) | |
static let flatDarkCardBackground = UIColor(red: 46, green: 46, blue: 46) | |
convenience init(red: Int, green: Int, blue: Int, a: CGFloat = 1.0) { | |
self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: a) | |
} | |
} | |
extension Color { | |
public init(decimalRed red: Double, green: Double, blue: Double) { | |
self.init(red: red / 255, green: green / 255, blue: blue / 255) | |
} | |
public static var flatDarkBackground: Color { | |
return Color(decimalRed: 36, green: 36, blue: 36) | |
} | |
public static var flatDarkCardBackground: Color { | |
return Color(decimalRed: 46, green: 46, blue: 46) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment