TDTSwiftyColor
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
TDTSwiftyColor is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "TDTSwiftyColor"
Usage
import TDTSwiftyColor
Properties
components
UIColor.black.components // (0.0, 0.0, 0.0, 1.0)
UIColor.white.components // (1.0, 1.0, 1.0, 1.0)
UIColor.red.components // (1.0, 0.0, 0.0, 1.0)
UIColor.green.components // (0.0, 1.0, 0.0, 1.0)
UIColor.blue.components // (0.0, 0.0, 1.0, 1.0)
UIColor.clear.components // (0.0, 0.0, 0.0, 0.0)
rgbString
UIColor.black.rgbString // "000000"
UIColor.white.rgbString // "FFFFFF"
UIColor.red.rgbString // "FF0000"
UIColor.green.rgbString // "00FF00"
UIColor.blue.rgbString // "0000FF"
UIColor.clear.rgbString // "000000"
argbString
UIColor.black.argbString // "FF000000"
UIColor.white.argbString // "FFFFFFFF"
UIColor.red.argbString // "FFFF0000"
UIColor.green.argbString // "FF00FF00"
UIColor.blue.argbString // "FF0000FF"
UIColor.clear.argbString // "00000000"
Initializers
UInt
UIColor(rgb: 0x000000)
UIColor(rgb: 0x000000, alpha: 0.5)
Hex String
UIColor(hex: "#0FF")
UIColor(hex: "#0000FF")
UIColor(hex: "#FF00FF00")
UIColor(hex: "0FF")
UIColor(hex: "0000FF")
UIColor(hex: "FF00FF00")
License
TDTSwiftyColor is available under the MIT license. See the LICENSE file for more info.