philackm / colorFromHex

Extension for UIColor in UIKit to create a colour from a hex string.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

colorFromHex

A simple extension written in Swift for UIColor in UIKit which adds a class function that returns a UIColor from the provided hex string. The colours are cached.

Usage

Parameters: hexString: String, the hex code for the color you want. Leading "#" is optional. Must be 6 hexadecimal digits long. (8 bits per color)

let someColor = UIColor.colorFromHex("#2d34aa")

About

Extension for UIColor in UIKit to create a colour from a hex string.

License:MIT License


Languages

Language:Swift 100.0%