各种颜色之间的转换,会陆续更新,
实现了 16进制颜色(HEX)、RGBA、HSBA、UIColor之间的 相互转换
使用示例(加号方法,类名调用)
1 //UIColor 转 RGB、HSB 2 RGBAColor colora = [ColorConversion UIColorToRGBA:[UIColor redColor]]; 3 HSBAColor colorb = [ColorConversion UIColorToHSBA:[UIColor redColor]]; 4 //RGB和HSB互转 5 RGBAColor colorc = [ColorConversion HSBTORGB:colorb]; 6 HSBAColor colord = [ColorConversion RGBTOHSB:colora]; 7 //16进制数字、字串转UIColor 8 UIColor * colore = [ColorConversion HEXNumTOUIColor:0xAFC078 Alpha:1]; 9 UIColor * colorf = [ColorConversion HEXStrTOUIColor:@"#AFC078" Alpha:1]; 10