Skip to content
Use iOS 13+ system colors while defaulting to light colors on iOS <=12
Swift Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Cocoapod config updates Oct 5, 2019
_Pods.xcodeproj Cocoapods configuration Oct 5, 2019
.gitignore
ColorCompatibility.podspec
ColorCompatibility.swift
LICENSE
README.md

README.md

ColorCompatibility

In iOS 13, Apple introduced a bunch of new system colors (label, systemBackground, etc). These colors dynamically adapt to the preferred user interface style, but these colors aren't available on iOS < 13. ColorCompatibility is an autogenerated library which allows you to specify the system colors as static vars of the ColorCompatibility namespace, instead of UIColor. Using this will make colors "just work" on both iOS 13+ and iOS <= 12. On iOS <= 12, the colors default to Apple's light mode colors.

E.g.:

import ColorCompatibility

myView.backgroundColor = ColorCompatibility.label

You can read more about this project here.

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ColorCompatibility is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ColorCompatibility'

If you'd prefer not to use Cocoapods, I recommend copy and pasting the ColorCompatibility.swift code directly into your project. It's only one file 👍

Author

Noah Gilmore, https://noahgilmore.com/blog

License

ColorCompatibility is available under the MIT license. See the LICENSE file for more info.

Contributing

If you see an issue, please report it via the GitHub issues tab. Pull requests are gladly accepted. You can get in touch with me on Twitter at https://twitter.com/noahsark769

You can’t perform that action at this time.