SkillAgentSearch skills...

HexColor

A convenient way to convert hex strings to UIColor or NSColor

Install / Use

/learn @zhiyongzou/HexColor
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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

Related Skills

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated4y ago
Forks2

Languages

Swift

Security Score

75/100

Audited on Feb 19, 2022

No findings