/IRHexColor

A convenient way to convert hex strings to UIColor or NSColor

Primary LanguageSwiftMIT LicenseMIT

IRHexColor

build CocoaPods Version License visitors

A convenient way to convert hex strings to UIColor or NSColor. IRHexColor support RGB and ARGB hex strings. In addition, IRHexColor will cache hex color for reusing which can improve performance.

Examples

let red = UIColor.hexColor("FF0000")
let green = UIColor.hexColor("#00FF00")
let blue = UIColor.hexColor("0000FF")

// ARGB hex string
let aquaAlpha = UIColor.hexColor("#10D4F2E7")
let yellowAlpha = UIColor.hexColor("08FFFF00")

Set cache count limit

// default is 100
UIColor.cacheCountLimit = 200

Installation

CocoaPods

pod 'IRHexColor'

Manually

Drag and drop IRHexColor.swift file into your project