ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - chrs1885/SheetyColors: An action sheet styled color picker for iOS.
An action sheet styled color picker for iOS. Contribute to chrs1885/SheetyColors development by creating an account on GitHub.
Visit Site

GitHub - chrs1885/SheetyColors: An action sheet styled color picker for iOS.

GitHub - chrs1885/SheetyColors: An action sheet styled color picker for iOS.

Awesome Cocoapods(https://cocoapods.org/pods/SheetyColors) Carthage compatible UIKit & SwiftUI iOS 13 Ready Swift Build Status Twitter

SheetyColors is an action sheet styled color picker for iOS:

  • ๐Ÿ“ฑ Based on UIAlertController: The SheetyColors API is based on UIKit's UIAlertController. Simply add buttons to it as you would for any other Action Sheet by defining UIAlertAction instances. Therefore, it nicely integrates with the look & feel of all other native system dialogs. However, you can also chose to use the color picker it self without an action sheet.
  • ๐ŸŽจ Fully configurable: You can choose between a variety of configurations such as
    • color model (RGB, HSB, or Grayscale)
    • alpha component support
    • haptic feedback
    • text/message label
  • ๐ŸŽš๏ธ Sliders and Hex input: You can create new colors by either using sliders or the newly added Hex input.
  • ๐Ÿ‘ถ Intuitive UI: Each slider comes with a gradient that gives you an idea of how changing individual slider values affects the resulting color. All controls do support haptic feedback and will react to any errors such as invalid Hex values.
  • ๐Ÿ SwiftUI & iOS 13 support: SheetyColors can also be used as part of your SwiftUI projects. Have a look at the Usage section to get further info. The library is also optimized to work well with the new Dark Mode.

Example

NEW: Hex input RGB, HSB, and Grayscale Fully configurable Dark mode support
Color picker supporting RGB, HSB, and Grayscale Color picker supporting RGB, HSB, and Grayscale Fully configurable Dark mode support

To get a quick overview, you can checkout the example app on Appetize.io. To run the example project from Xcode, clone the repo, and run pod install from the Example directory first.

Installation

There are currently four different ways to integrate SheetyColors into your apps.

CocoaPods

use_frameworks!

target 'MyApp' do
  pod 'SheetyColors'
end

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/chrs1885/SheetyColors.git", from: "1.2.1")
]

Carthage

github "chrs1885/SheetyColors"

Manually

Simply drop SheetyColors.xcodeproj into your project. Also make sure to add SheetyColors.framework to your appโ€™s embedded frameworks found in the General tab of your main project.

Usage

Creating a SheetyColors picker is as easy as creating a normal .actionSheet styled UIAlertController. First, you need to import the library:

import SheetyColors

Next, simply create a SheetyColorsController instance and add some actions to it:


// Create a SheetyColors view with your configuration
let config = SheetyColorsConfig(alphaEnabled: true, initialColor: color, hapticFeedbackEnabled: true, title: "Create a color", type: .rgb)
let sheetyColors = SheetyColorsController(withConfig: config)

// Add a button to accept the selected color
let selectAction = UIAlertAction(title: "Save Color", style: .default, handler: { _ in
	self.color = sheetyColors.color
}
sheetyColors.addAction(selectAction)

// Add a cancel button
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
sheetyColors.addAction(cancelAction)

// Now, present it to the user
present(sheetyColors, animated: true, completion: nil)
        

Please check the documentation for further information on the API.

Custom container views

If you prefer to use the color picker inside a custom view controller, you can do so by creating the picker's view controller directly:

return SheetyColorsViewFactory.createView(withConfig: config, delegate: myDelegate)

The class of the myDelegate instance needs to conform to the SheetyColorsDelegate:

class MyViewController: SheetyColorsDelegate {

	...
	
	func didSelectColor(_ color: UIColor) {
	    self.color = color
	}
}

didSelectColor will be called on any slider change.

SwiftUI support

With SwiftUI projects the color picker can't be used inside the action sheet that Apple provides. However, you can embed the view inside your custom view container by using the SheetyColorsView:

struct ContentView: View {
	@State var selectedColor: UIColor = UIColor.white
	let config = SheetyColorsConfig(alphaEnabled: true, hapticFeedbackEnabled: true, initialColor: UIColor.red, type: .rgb)

	var body: some View {
		Text("Select a color")
			.foregroundColor(Color(self.$selectedColor.wrappedValue))
		SheetyColorsView(config: config, color: self.$selectedColor)
	}
}

Here's an example of how creating an action sheet styled color picker with SwiftUI and SheetyColors.

Contributions

We'd love to see you contributing to this project by proposing or adding features, reporting bugs, or spreading the word. Please have a quick look at our contribution guidelines.

License

SheetyColors is available under the MIT license. See the LICENSE file for more info.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory