当我从Android 转向 IOS, 我去这颜色是什么鬼,这么麻烦
let Yellow = UIColor.init(red: 230/255.0, green: 166/255.0, blue: 0/255.0, alpha: 1)
扩展一下使用方式
var color: BDYColor = BDYColor(hexRGB: 0xE1E2E6)
public typealias BDYColor = UIColor
extension BDYColor {
//MARK: - Hex
public convenience init(hexRGB: Int, alpha: CGFloat = 1.0) {
self.init(red:CGFloat((hexRGB >> 16) & 0xff) / 255.0,
green:CGFloat((hexRGB >> 8) & 0xff) / 255.0,
blue:CGFloat(hexRGB & 0xff) / 255.0,
alpha: alpha)
}
public class func randomColor() -> BDYColor {
return OKColor(red: CGFloat(arc4random_uniform(255)) / 255.0,
green: CGFloat(arc4random_uniform(255)) / 255.0,
blue: CGFloat(arc4random_uniform(255)) / 255.0,
alpha: 1.0)
}
}
网友评论