zakkhoyt / ColorPicKit

A collection of UIControls for picking colors on iPhone, iPad, and other iOS devices. Gradient slider, Hue slider, RGB sliders, HSB sliders, CMYK sliders, ImagePixelPicker, HSB Wheel, HSB Spectrum. Color related class extensions
MIT License
15 stars 4 forks source link

Add init methods to UIColor #7

Closed zakkhoyt closed 7 years ago

zakkhoyt commented 7 years ago

Add init methods which accept our tuples RGB, HSB, CMYK

zakkhoyt commented 7 years ago

I added the following class factory methods

    public class func colorWith(hexString: String, alpha: CGFloat = 1.0) -> UIColor 

    public class func colorWith(rgb: RGB, alpha: CGFloat = 1.0) -> UIColor 

    public class func colorWith(hsb: HSB, alpha: CGFloat = 1.0) -> UIColor 

    public class func colorWith(cmyk: CMYK, alpha: CGFloat = 1.0) -> UIColor 

and the following inits

    public convenience init(rgb: RGB, alpha: CGFloat = 1.0) 
    public convenience init(hsb: HSB, alpha: CGFloat = 1.0) 
    public convenience init(cmyk: CMYK, alpha: CGFloat = 1.0) 

as well as adding an optional alpha parameter to

public convenience init(hexString:String, alpha: CGFloat = 1.0) {