2018-07-02 23:02:07 +08:00
2018-08-03 16:52:34 -05:00
2015-07-12 21:36:16 -05:00
2016-12-07 09:25:59 -06:00
2018-07-02 10:31:29 -05:00

RAScrollablePickerView

Preview

Lightweight HSB color picker view in Swift.

Usage

Just drop RAScrollablePickerView in your project.

Then create 3 instances of the scrollable picker view and assign each a different type.

huePicker.delegate = self

saturationPicker.delegate = self
saturationPicker.type = .saturation
saturationPicker.hueValueForPreview = huePicker.value

brightnessPicker.delegate = self
brightnessPicker.type = .brightness
brightnessPicker.hueValueForPreview = huePicker.value

Finally make sure the parent view/viewcontroller conforms to RAScrollablePickerViewDelegate and add the required valueChanged method.

func valueChanged(_ value: CGFloat, type: PickerType) {
    switch(type) {
    case .hue:
        colorPreView.backgroundColor = UIColor(hue: value, saturation: saturationPicker.value, brightness: brightnessPicker.value, alpha: 1)
        saturationPicker.hueValueForPreview = value
        brightnessPicker.hueValueForPreview = value
    case .saturation:
        colorPreView.backgroundColor = UIColor(hue: huePicker.value, saturation: value, brightness: brightnessPicker.value, alpha: 1)
    case .brightness:
        colorPreView.backgroundColor = UIColor(hue: huePicker.value, saturation: saturationPicker.value, brightness: value, alpha: 1)
    }
}

Contact

Feel free the reach out to me if you have an questions.

S
Description
Lightweight HSB color picker view.
Readme Apache-2.0
2 MiB
Languages
Swift 94.5%
Objective-C 5.5%