SwiftColors 是 HEX 颜色处理工具,作为 UIColor 的扩展,使用 Swift 编写。
示例:
// Most simple way let colorFromInt: UIColor = 0x3ab976 // With hash let color: UIColor = UIColor(hexString: "#ff8942") // Without hash, with alpha let secondColor: UIColor = UIColor(hexString: "ff8942", alpha: 0.5) // Short handling let shortColorWithHex: UIColor = UIColor(hexString: "fff")