https://github.com/kgn/kgncolor
A collection of UIColor extensions
https://github.com/kgn/kgncolor
color hex swift ui uikit
Last synced: about 1 year ago
JSON representation
A collection of UIColor extensions
- Host: GitHub
- URL: https://github.com/kgn/kgncolor
- Owner: kgn
- License: mit
- Created: 2015-10-16T14:19:53.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T06:38:58.000Z (over 6 years ago)
- Last Synced: 2025-06-15T07:02:08.515Z (about 1 year ago)
- Topics: color, hex, swift, ui, uikit
- Language: Swift
- Size: 61.5 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KGNColor
`KGNColor` is a collection of helpful `UIColor` extensions.
[]()
[](/releases)
[](/LICENSE)
[](https://travis-ci.org/kgn/KGNColor)
[]()
[](https://github.com/Carthage/Carthage)
[](https://cocoapods.org/pods/KGNColor)
[](https://cocoapods.org/pods/KGNColor)
[](http://twitter.com/iamkgn)
[](https://github.com/kgn)
[](https://github.com/kgn/KGNColor)
## Installing
### Carthage
```
github "kgn/KGNColor"
```
### CocoaPods
```
pod 'KGNColor'
```
## Examples
### Hex Initializer
Using a hex value is often the easiest way to use the exact color from a design.
``` Swift
let tintColor = UIColor(hex: 0x2DFF5F)
```
### Components
Used this helpful tuple to get the `red`, `green`, `blue` and `alpha` values of a `UIColor`.
``` Swift
let tintColor = UIColor.brown
print("red: \(tintColor.components.red)")
print("green: \(tintColor.components.green)")
print("blue: \(tintColor.components.blue)")
print("alpha: \(tintColor.components.alpha)")
```
### Invert a Color
``` Swift
let tintColor = UIColor.red.inverted
```
### Lighten a Color
``` Swift
let tintColor = UIColor.blue.lighten(0.5)
```
### Darken a Color
``` Swift
let tintColor = UIColor.green.darken(0.5)
```
## Progress
- [X] Badges
- [X] Tests
- [X] Travis
- [X] Carthage
- [X] CocoaPods
- [X] Description
- [X] Documentation
- [X] AppleTV
- [X] AppleWatch
- [X] Prebuilt Frameworks
- [ ] Travis Test Matrix