UIAppleColor
UIAppleColor copied to clipboard
Apple System Colors
UIAppleColor
- Apple System Color
- Versions below iOS 13 use the Light/Dark Mode Color
Example
let label = UILabel()
if #available(iOS 13.0, *) {
label.textColor = .label
} else {
label.textColor = .black
}
// Use UIAppleColor
label.textColor = UIColor.apple.label
public extension UIColor {
static let apple: UIAppleColor
}
public struct UIAppleColor {
var systemBackground: UIColor
var secondarySystemBackground: UIColor
var tertiarySystemBackground: UIColor
var systemGroupedBackground: UIColor
var secondarySystemGroupedBackground: UIColor
var tertiarySystemGroupedBackground: UIColor
var systemFill: UIColor
var secondarySystemFill: UIColor
var tertiarySystemFill: UIColor
var quaternarySystemFill: UIColor
var lightText: UIColor
var darkText: UIColor
var label: UIColor
var secondaryLabel: UIColor
var tertiaryLabel: UIColor
var quaternaryLabel: UIColor
var link: UIColor
var placeholderText: UIColor
var separator: UIColor
var opaqueSeparator: UIColor
var systemRed: UIColor
var systemGreen: UIColor
var systemBlue: UIColor
var systemOrange: UIColor
var systemYellow: UIColor
var systemPink: UIColor
var systemPurple: UIColor
var systemTeal: UIColor
var systemIndigo: UIColor
var systemGray: UIColor
var systemGray2: UIColor
var systemGray3: UIColor
var systemGray4: UIColor
var systemGray5: UIColor
var systemGray6: UIColor
}
When using dark mode below iOS 13
// once in the first time
UIAppleColor.setup(mode: .dark)
let label = UILabel()
label.textColor = UIColor.apple.label
let label = UILabel()
label.textColor = UIColor.apple.mode(.dark).label
Installation
CocoaPods
UIAppleColor is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "UIAppleColor"
Carthage
For iOS 8+ projects with Carthage
github "Kofktu/UIAppleColor"
References
- Apple HIG Color (https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/)
Authors
Taeun Kim (kofktu), [email protected]
License
Sniffer is available under the MIT
license. See the LICENSE
file for more info.