func colorValueToFloat(_ value:CGFloat)->CGFloat{
return value/255.0
}
func colorValueToFloat(value: CGFloat) -> CGFloat {
return value / 255.0
}
第一种引用
public func rgba(r:CGFloat,g:CGFloat,b:CGFloat,a:CGFloat)->UIColor{
return UIColor(red: colorValueToFloat(r), green: colorValueToFloat(g), blue: colorValueToFloat(b), alpha: a)
}
第二种引用
public func RGB(r:CGFloat, g:CGFloat, b:CGFloat ) -> UIColor {
return UIColor(red: colorValueToFloat(value: r), green: colorValueToFloat(value: g), blue: colorValueToFloat(value: b), alpha: 1)
}