An open API service indexing awesome lists of open source software.

https://github.com/devxoul/swiftycolor

🎨 The most sexy way to use colors in Swift.
https://github.com/devxoul/swiftycolor

color swift

Last synced: 3 months ago
JSON representation

🎨 The most sexy way to use colors in Swift.

Awesome Lists containing this project

README

        

SwiftyColor
===========

![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)
[![CocoaPods](http://img.shields.io/cocoapods/v/SwiftyColor.svg?style=flat)](http://cocoapods.org/?q=name%3ASwiftyColor%20author%3Adevxoul)
[![CI](https://github.com/devxoul/SwiftyColor/workflows/CI/badge.svg)](http://github.com/devxoul/SwiftyColor/actions)

The most sexy way to use colors in Swift. Both compatible with iOS and macOS.

Color from Hex
--------------

```swift
let color = 0x123456.color
```

Alpha Operator
--------------

Use infix operator `~`.

```swift
let transparent = 0x123456.color ~ 50%
let red = UIColor.red ~ 10%
let float = UIColor.blue ~ 0.5 // == 50%
```

Percent Operator
----------------

```swift
let view = UIView()
view.alpha = 30% // == 0.3
```

License
-------

SwiftyColor is under MIT license. See LICENSE file for more information.