{"id":15038589,"url":"https://github.com/pdil/pdcolorpicker","last_synced_at":"2025-04-09T23:41:05.661Z","repository":{"id":62449840,"uuid":"99752165","full_name":"pdil/PDColorPicker","owner":"pdil","description":"🎨 A simple, fast color picker for iOS apps.","archived":false,"fork":false,"pushed_at":"2023-10-21T03:35:03.000Z","size":13807,"stargazers_count":31,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T11:02:15.579Z","etag":null,"topics":["cocoapods","color-picker","ios","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-09T01:31:44.000Z","updated_at":"2024-01-03T14:21:28.000Z","dependencies_parsed_at":"2024-09-28T22:20:27.124Z","dependency_job_id":"ca75cd4f-2b7b-4ac5-8200-aaf9f8d7c166","html_url":"https://github.com/pdil/PDColorPicker","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdil%2FPDColorPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdil%2FPDColorPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdil%2FPDColorPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdil%2FPDColorPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdil","download_url":"https://codeload.github.com/pdil/PDColorPicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131468,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods","color-picker","ios","swift"],"created_at":"2024-09-24T20:39:04.878Z","updated_at":"2025-04-09T23:41:05.634Z","avatar_url":"https://github.com/pdil.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](https://raw.githubusercontent.com/pdil/PDColorPicker/master/Design/Logo.png)\n\n----\n\n[![Version](https://img.shields.io/github/release/pdil/PDColorPicker/all.svg)](https://github.com/pdil/PDColorPicker/releases)\n[![Platform](https://img.shields.io/cocoapods/p/PDColorPicker.svg)](http://cocoapods.org/pods/PDColorPicker)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)\n[![CocoaPods compatible](https://img.shields.io/badge/CocoaPods-compatible-4BC51D.svg)](https://cocoapods.org/pods/PDColorPicker)\n[![Downloads](https://img.shields.io/cocoapods/dt/PDColorPicker.svg)](http://cocoapods.org/pods/PDColorPicker)\n\n\n| Branch | Status | Coverage |\n| ------ | ------ | -------- |\n| `master` (v0.8.5) | [![CI Status](http://img.shields.io/travis/pdil/PDColorPicker/master.svg?style=flat)](https://travis-ci.org/pdil/PDColorPicker) | [![codecov](https://codecov.io/gh/pdil/PDColorPicker/branch/master/graph/badge.svg)](https://codecov.io/gh/pdil/PDColorPicker/branch/master) |\n| `develop` | [![CI Status](http://img.shields.io/travis/pdil/PDColorPicker/develop.svg?style=flat)](https://travis-ci.org/pdil/PDColorPicker/branches) | [![codecov](https://codecov.io/gh/pdil/PDColorPicker/branch/develop/graph/badge.svg)](https://codecov.io/gh/pdil/PDColorPicker/branch/develop) |\n\n\n🎨 **PDColorPicker** is an open source iOS library that lets developers include a color picker in their apps, allowing users to easily select colors in a variety of formats. This library is open for collaboration with the community so anyone is invited to submit issues or pull requests.\n\n| Demo              | Table of Contents |\n| ----------------- | ----------------- |\n| [\u003cimg src=\"https://raw.githubusercontent.com/pdil/PDColorPicker/master/Resources/demo.gif\" width=300\u003e](https://giphy.com/gifs/10ofmG3LCZMImI/fullscreen) | [📄 Requirements](README.md#-requirements)\u003cbr\u003e\u003cbr\u003e[💻 Installation](README.md#-installation)\u003cbr\u003e\u003cul\u003e\u003cli\u003e[CocoaPods](README.md#cocoapods)\u003c/li\u003e\u003cli\u003e[Carthage](README.md#carthage)\u003c/li\u003e\u003cli\u003e[Manual](README.md#manual-not-recommended)\u003c/li\u003e\u003c/ul\u003e[📝 Usage](README.md#-usage)\u003cbr\u003e\u003cbr\u003e[📲 Drag and Drop](README.md#-drag-and-drop)\u003cbr\u003e\u003cbr\u003e[🎨 **PDColorPicker** in other apps](README.md#-pdcolorpicker-in-other-apps)\u003cbr\u003e\u003cbr\u003e[🙋‍♂️ Author](README.md#%EF%B8%8F-author)\u003cbr\u003e\u003cbr\u003e[⚖️ License](README.md#%EF%B8%8F-license) |\n\n----\n\n## 📄 Requirements\n\n* iOS 9.0 or later (iOS 11.0+ for drag and drop)\n* Xcode 10.2 or later\n* Swift 5 or later\n\n## 💻 Installation\n\n### Cocoapods\n\n`PDColorPicker` is available through [CocoaPods](http://cocoapods.org).\n\nIf you have not done so already, run `pod setup` from the root directory of your application.\n\nTo install `PDColorPicker`, simply add the following line to the Podfile:\n\n```ruby\npod 'PDColorPicker'\n```\n\nThis line should be added to the app's target so that it looks something like this:\n\n```ruby\nuse_frameworks!\n\ntarget 'TARGET_NAME' do\n  pod 'PDColorPicker'\n\n  # other pods...\nend\n```\n\n\u003e **Older Swift Versions**\n\u003e\n\u003e If the project is not built for Swift 4.2, install from the `swift-3.2`, `swift-4.1` or the `swift-4.2` branches:\n\u003e ```ruby\n\u003e pod 'PDColorPicker', :git =\u003e 'https://github.com/pdil/PDColorPicker.git', :branch =\u003e 'swift-4.2'\n\u003e ```\n\u003e Note that this build may not include all of the latest features of `PDColorPicker`.\n\nBuild the CocoaPods frameworks by running the following command in the Terminal from the root project directory:\n\n```\n$ pod install\n```\n\nOpen the newly created `.xcworkspace` file and build the project to make `PDColorPicker` available.\n\n**Note**: Be sure to always work inside the `.xcworkspace` file and **not** the `.xcodeproj` file, otherwise Xcode will not be able to locate the dependencies and `PDColorPicker` will not be accessible.\n\n### Carthage\n\n`PDColorPicker` is available through [Carthage](https://github.com/carthage/carthage).\n\nIf you haven't installed Carthage yet, use Homebrew to install it:\n\n```\n$ brew update\n$ brew install carthage\n```\n\nCreate a Cartfile inside the root project directory with the following line (or add this line if you already have a Cartfile):\n\n```\ngithub \"pdil/PDColorPicker\"\n```\n\n\u003e **Older Swift Versions**\n\u003e\n\u003e If the project is not built for Swift 4.2, install from the `swift-3.2`, `swift-4.1` or the `swift-4.2` branches:\n\u003e ```\n\u003e github \"pdil/PDColorPicker\" \"swift-4.2\"\n\u003e ```\n\u003e Note that this build may not include the latest features of `PDColorPicker`.\n\nBuild the Carthage frameworks by running the following command in the Terminal from the root project directory:\n\n```\n$ carthage update\n```\n\nThis will build the framework inside the `Carthage/build` folder.\n\nLastly, add the framework to your project:\n\n* In Xcode, select the project in the Project Navigator in Xcode (blue icon).\n* Open the \"General\" tab on the top bar.\n* Drag `PDColorPicker.framework` from the `Carthage/build` folder into the \"Embedded Binaries\" section.\n\n### Manual (not recommended)\n\n* Download the `.swift` files inside [PDColorPicker/Classes](https://github.com/pdil/PDColorPicker/tree/master/PDColorPicker/Classes) and add them to your project.\n* Add the files to the appropriate target(s) within the project.\n* Import `PDColorPicker` as you normally would.\n\n## 📝 Usage\n\n```swift\nimport UIKit\nimport PDColorPicker  // 1.\n\nclass MyViewController: UIViewController, Dimmable {\n    // ...\n  \n    func presentColorPicker() {\n        // 2.\n        let colorPickerVC = PDColorPickerViewController(initialColor: .blue, tintColor: .black)\n\n        // 3.\n        colorPickerVC.completion = {\n            [weak self] newColor in\n\n            self?.undim() // 7.\n\n            guard let color = newColor else {\n                print(\"The user tapped cancel, no color was selected.\")\n                return\n            }\n\n            print(\"A new color was selected! HSBA: \\(String(describing: color))\")\n         }\n  \n         // 4.\n         dim() // see Dimmable documentation for extra options\n    \n         // 5.\n         present(colorPickerVC, animated: true)\n    }\n  \n    // ...\n}\n```\n\n1. Import the  `PDColorPicker` framework.\n2. Instantiate a new `PDColorPickerViewController`.\n3. Set the completion handler of the color picker, indicating what the presenting view controller should do with the color result. **Note**: this can also be set in the `PDColorPickerViewController` initializer.\n4. Implement the `Dimmable` protocol and dim the presenting view controller (optional but highly recommended).\n5. Present the color picker as a modal view controller.\n6. Use the color picker to select a color. When **Save** or **Cancel** is tapped, the completion handler specified in the initializer will automatically provide the new color. If the user taps cancel, `nil` is returned.\n7. Be sure to undim the view once the completion handler is called.\n\n### Bonus\n\nTo achieve the white status bar while the presenting view controller is dimmed, set `UIViewControllerBasedStatusBarAppearance` to `YES` in your `Info.plist`.\n\nYou can also copy the code here into the plist file:\n```\n\u003ckey\u003eUIViewControllerBasedStatusBarAppearance\u003c/key\u003e\n\u003ctrue/\u003e\n```\n\n## 📲 Drag and Drop\n\nDrag and drop is also supported in projects that target iOS 11.0 or later.\n\n[\u003cimg src=\"https://raw.githubusercontent.com/pdil/PDColorPicker/master/Resources/drag-drop-demo.gif\" width=600\u003e](https://giphy.com/gifs/6TNPgdZ3W4qMo/fullscreen)\n\nSee `PDColorReceiverExample` for an example on how to consume a color that is dragged into your app. The drag and drop implementation of `PDColorPicker` exposes a basic `UIColor` so that it can be read by apps that don't necessarily import `PDColorPicker`.\n\nOf course, if the destination app imports `PDColorPicker`, it will have access to the convenient `PDColor` class which it could instantiate with the received `UIColor`:\n\n```swift\nfunc dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) {\n  session.loadObjects(ofClass: UIColor.self) {\n    guard let color = $0.first as? UIColor else { return }\n\n    let pdColor = PDColor(color: color)\n    print(pdColor.hex)\n  }\n}\n```\n\n## 🎨 `PDColorPicker` in other apps\nHere is a list of apps that use **PDColorPicker** to let their users select colors:\n\n* 🌮 [FoodEase](https://foodease.xyz)\n* 🎨 [Paint Shapes](https://itunes.apple.com/us/app/paint-shapes/id1366164052)\n\nIf your app is using **PDColorPicker**, [let me know](mailto:dilorenzo@hey.com?subject=PDColorPicker) and I'll add it to this list (include an emoji to represent your app in the list, the app name, and a web or download URL)!\n\n## 🙋‍♂️ Author\n\nPaolo Di Lorenzo\n\n[![Email](https://img.shields.io/badge/email-dilorenzo@hey.com-red.svg)](mailto:dilorenzo@hey.com?subject=PDColorPicker)\n[![Website](https://img.shields.io/badge/web-dilorenzo.pl-red.svg)](https://dilorenzo.pl)\n[![Twitter](https://img.shields.io/badge/twitter-%40dilorenzopl-4099FF.svg)](https://twitter.com/dilorenzopl)\n[![Stackoverflow](https://img.shields.io/badge/stackoverflow-%40Paolo-FF9900.svg)](https://stackoverflow.com/users/7264964/paolo)\n\n## ⚖️ License\n[![License](https://img.shields.io/cocoapods/l/PDColorPicker.svg?style=flat)](https://github.com/pdil/PDColorPicker/blob/master/LICENSE.md)\n\nPDColorPicker is available under the MIT license. See the [LICENSE](https://github.com/pdil/PDColorPicker/blob/master/LICENSE.md) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdil%2Fpdcolorpicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdil%2Fpdcolorpicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdil%2Fpdcolorpicker/lists"}