Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timoliver/uicolor-legacysemanticcolors
A UIColor category that backports the new semantic colors of iOS 13 to iOS 12.
https://github.com/timoliver/uicolor-legacysemanticcolors
Last synced: about 1 month ago
JSON representation
A UIColor category that backports the new semantic colors of iOS 13 to iOS 12.
- Host: GitHub
- URL: https://github.com/timoliver/uicolor-legacysemanticcolors
- Owner: TimOliver
- License: mit
- Created: 2020-04-22T16:34:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-04-26T10:02:40.000Z (over 4 years ago)
- Last Synced: 2024-09-24T14:47:56.423Z (about 2 months ago)
- Language: Objective-C
- Size: 523 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# UIColor-LegacySemanticColors
[![Version](https://img.shields.io/cocoapods/v/UIColor+LegacySemanticColors.svg?style=flat)](http://cocoadocs.org/docsets/UIColor+LegacySemanticColors)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/TimOliver/UIColor-LegacySemanticColors/master/LICENSE)
[![PayPal](https://img.shields.io/badge/paypal-donate-blue.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=M4RKULAVKV7K8)
[![Twitch](https://img.shields.io/badge/twitch-timXD-6441a5.svg)](http://twitch.tv/timXD)*A very basic back-port of the `UIColor` semantic color APIs introduced in iOS 13.*
`UIColor-LegacySemanticColors` is an Objective-C category on `UIColor` that uses features of the runtime to dynamically implement the semantic color API methods from iOS 13 with similar behaving ones in iOS 12. It also allows configuration to display either light or dark mode variants of each color.
On iOS 13 and up, this library is a no-op, ensuring there will not be any breaking behaviour in future versions of iOS.
The goal of this library is to simplify Dark Mode in iOS 13, while also supporting iOS 12.
## Features
* Source compatibility with the semantic color APIs in iOS 13.
* Support for light and dark color variants.
* Performs no runtime modifying code in iOS 13 and above, making it safe for future versions.## Requirements
* iOS 12.0
* Xcode 11.0 or higher
* Objective-C only (I sadly discovered it doesn't work in Swift... 😅)## Installation Instructions
CocoaPods
pod 'UIColor+LegacySemanticColors'Carthage
Carthage is not supported at this time. If you would like Carthage support, please file a PR.Manual Installation
Simply move the `UIColor-LegacySemanticColors` folder to your Xcode project and import it.## Sample Code
The API behaves just like the official one in iOS 13.
### Objective-C
```objc
// Set all returned colors to be dark variants
[UIColor setLegacyInterfaceStyle:UIUserInterfaceStyleDark];// Get the default label color
UIColor *labelColor = [UIColor labelColor];
```## Credits
Developed by [Tim Oliver](http://twitter.com/TimOliverAU).
Device mockup by [Pixeden](http://pixeden.com).
Special thanks to [Noah Gilmore](https://twitter.com/noahsark769) for [publishing the hex codes](https://noahgilmore.com/blog/dark-mode-uicolor-compatibility/) for all of the semantic colors.
## License
`UIColor-LegacySemanticColors` is licensed under the MIT License, please see the [LICENSE](LICENSE) file.