https://github.com/kautenja/uipopupcolorpicker
a simple PopupDialog for picking a color from a list of colors
https://github.com/kautenja/uipopupcolorpicker
carthage color-palette color-picker ios ios-framework popup-dialog ui-components
Last synced: 3 months ago
JSON representation
a simple PopupDialog for picking a color from a list of colors
- Host: GitHub
- URL: https://github.com/kautenja/uipopupcolorpicker
- Owner: Kautenja
- License: mit
- Created: 2017-07-18T07:06:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-18T00:35:37.000Z (about 8 years ago)
- Last Synced: 2025-04-08T13:52:01.696Z (6 months ago)
- Topics: carthage, color-palette, color-picker, ios, ios-framework, popup-dialog, ui-components
- Language: Swift
- Homepage:
- Size: 45.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UIPopupColorPicker
[![swift-badge][]][swift-link]
[![carthage-badge][]][carthage-link][swift-badge]: https://img.shields.io/badge/swift-4.0-orange.svg
[swift-link]: https://swift.org/
[carthage-badge]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat
[carthage-link]: https://github.com/Carthage/Carthage## Screenshots
The standard theme
An example of custom theme utilizing tint color, font, and a custom list of colors
## Installation
### Carthage
add the folowing to your Carfile:
```ruby
github "kautenja/UIPopupColorPicker" ~> 1.1
```## Example
To run the example project, clone the repo, and it in Xcode on devices of your choosing, there is an example UI
setup to access the picker.### Code Usage
#### Creation
UIPopupColorPicker is accessed through the single static function:
```swift
let _ = UIPopupColorPicker.show(on: self, block: nil)
```This function returns an instance of BColorPicker in case you might want to
manipulate some of the controller manually.#### Customization
```swift
let popup = UIPopupColorPicker.show(on: self, block: nil)
popup.tintColor = #colorLiteral(red: 0.1568514521,
green: 0.680490051,
blue: 0.9768045545,
alpha: 1)
popup.buttonFont = UIFont(name: "HelveticaNeue", size: 18.0)!
popup.colorList = [UIColor.gray, UIColor.blue, UIColor.yellow]
```#### Callback
One way of handling color change is to implement a handler function
```swift
/// Handle a color selection from UIPopupColorPicker
func colorDidChange(to color: UIColor?) {
}let _ = UIPopupColorPicker.show(on: self, block: colorDidChange)
```or like this using an escaping closure
```swift
let _ = UIPopupColorPicker.show(on: self) { color in
// handle color change with escaping closure
}
```### Code Samples
see [ViewController](PopupColorPicker/ViewController.swift) for a working example of the popup.
## License
**TL;DR** do what you want with it.
UIPopupColorPicker is available under the MIT license. See the [LICENSE](./LICENSE) file for more
info.