Skip to content

johnclayton/ColorCompatibility

 
 

Repository files navigation

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

About

Use iOS 13+ system colors while defaulting to light colors on iOS <=12

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 85.7%
  • Ruby 14.3%