Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 1.72 KB

README.md

File metadata and controls

59 lines (38 loc) · 1.72 KB

Colory

Swift 3, 4 Build Status CocoaPods Compatible Carthage License

A UIControl for picking color from HSB color palette.

Screenshot

P.S. Gradient looks way smoother on device than this gif.

Installation

CocoaPods

To install Colory using CocoaPods, add following line to your Podfile:

pod 'Colory'

Carthage

To install Colory using Carthage, add following line to your Cartfile:

github "crazytonyli/Colory"

Usage

Colory has very simple API.

Register action with valueChanged event to receive picked color changes.

let pickerView = ColorPickerView()
pickerView.addTarget(self, action: #selector(colorChanged(_:)), for: .valueChanged)

Use color property to get and set currently picked color.

@objc func colorChanged(_ pickerView: ColorPickerView) {
    update(with: pickerView.color)
}

Use layoutMargins to customize palette margins.

pickerView.layoutMargins = UIEdgeInsets(top: pickerView.layoutMargins.top,
                                        left: 20,
                                        bottom: pickerView.layoutMargins.bottom,
                                        right: 20)

LICENSE

This library is released under MIT License.