- Notifications
You must be signed in to change notification settings - Fork128
🎨 An intuitive iOS color picker built in Swift.
License
NotificationsYou must be signed in to change notification settings
joncardasis/ChromaColorPicker
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
An intuitive HSB color picker built in Swift. Supports multiple selection handles and is customizable to your needs.
Looking for version 1.x?
Version 1.x.x can be found on thelegacy branch. While the pod is still available, it is deprecated and projects should migrate to 2.0.
letcolorPicker=ChromaColorPicker(frame:CGRect(x:0, y:0, width:300, height:300))addSubview(colorPicker)// Optional: Attach a ChromaBrightnessSlider to a ChromaColorPickerletbrightnessSlider=ChromaBrightnessSlider(frame:CGRect(x:0, y:0, width:280, height:32))addSubview(brightnessSlider)colorPicker.connect(brightnessSlider) // or `brightnessSlider.connect(to: colorPicker)`
- View theExample app for more.
// Add handle at colorletpeachColor=UIColor(red:1, green:203/255, blue:164/255, alpha:1)colorPicker.addHandle(at: peachColor)// Add handle with referenceletcustomHandle=ChromaColorHandle()customHandle.color=UIColor.purplecolorPicker.addHandle(customHandle)// Add handle and keep referencelethandle= colorPicker.addHandle(at:.blue)
lethomeHandle=ChomaColorHandle(color:.blue)letimageView=UIImageView(image: #imageLiteral(resourceName:"home-icon").withRenderingMode(.alwaysTemplate))imageView.contentMode=.scaleAspectFitimageView.tintColor=.whitehomeHandle.accessoryView= imageViewhomeHandle.accessoryViewEdgeInsets=UIEdgeInsets(top:2, left:4, bottom:4, right:4)colorPicker.addHandle(homeHandle)
github"joncardasis/ChromaColorPicker"pod'ChromaColorPicker'Add all files from theSource folder to your project.
| Component | Description |
|---|---|
| ChromaColorPicker | An HSB color picker with support for adding multiple color selection handles. |
| ChromaBrightnessSlider | A slider UIControl which can be attached to anyChromaColorPicker via theconnect(to:) method. ChromaBrightnessSlider can also function as a stand-alone UIControl. |
BothChromaBrightnessSlider andChromaColorPicker conform to UIControl. Each send UIControlEvents which can be observed via viaUIControl'saddTarget method.
ChromaColorPicker
| Event | Description |
|---|---|
.valueChanged | Called whenever the color has changed. |
.touchUpInside | Called when a handle is released. |
ChromaBrightnessSlider
| Event | Description |
|---|---|
.touchDown | Called when a the slider is grabbed. |
.valueChanged | Called whenever the slider is moved and the value has changed. |
.touchUpInside | Called when the slider handle is released. |
// ExamplebrightnessSlider.addTarget(self, action: #selector(sliderDidValueChange(_:)), for:.valueChanged)@objcfunc sliderDidValueChange(_ slider:ChromaBrightnessSlider){print("new color:\(slider.currentColor)")}
ChromaColorPicker is available under the MIT license. See the LICENSE file for more info.
About
🎨 An intuitive iOS color picker built in Swift.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.

