Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.24 KB

README.md

File metadata and controls

49 lines (36 loc) · 1.24 KB

HexColor

build CocoaPods Version License visitors

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

Examples

RGB hex string

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

ARGB hex string

let aquaAlpha = UIColor.hexColor("99D4F2E7")
let yellowAlpha = UIColor.hexColor("88FFFF00")

RGBA hex string

let aquaAlpha = UIColor.hexColor("D4F2E799", type: .ARGB)
let yellowAlpha = UIColor.hexColor("FFFF0088", type: .ARGB)

Set Color cache count limit

// default is 100
UIColor.cacheCountLimit = 200

Installation

CocoaPods

pod 'IRHexColor'

Manually

Drag and drop HexColor.swift file into your project