SheetyColors is an action sheet styled color picker for iOS

Overview

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.

Comments
  • iOS 13 not working

    iOS 13 not working

    What did you do?

    I was testing my app on iOS 13 beta 4

    What did you expect to happen?

    I expected it work as it does on iOS 12

    What happened instead?

    The color section and sliders were all gray

    opened by schenkty 18
  • Material Action Sheet

    Material Action Sheet

    Please fill out all lines starting with a 📝 when filing a feature request to give us an idea of what exactly went wrong.

    What kind of feature would you like to see?

    📝Would be great if we can use this cool colour picker inside a Material Action Sheet by Google. And using Material Sliders.

    How does it work in detail?

    📝

    What does the API look like?

    📝https://material.io/develop/ios/components/action-sheet/ https://material.io/develop/ios/components/sliders/

    Any existing projects that do something similiar?

    📝Not that I'm aware of.

    opened by ItzNotABug 3
  • Dark Mode Support

    Dark Mode Support

    What kind of feature would you like to see?

    Add support for Dark Mode (iOS 13)

    How does it work in detail?

    Change colors based on current dark mode status.

    What does the API look like?

    Any existing projects that do something similiar?

    opened by chrs1885 2
  • HEX-Color input field

    HEX-Color input field

    What kind of feature would you like to see?

    Currently, the only way to create a color is by using the slider controls. To do so, you have to know the color values for RGB(HSB/Grayscale in advance. That being said, it's pretty much impossible to create a color by its HEX value.

    How does it work in detail?

    Provide a hex input field inside the preview color view.

    What does the API look like?

    Perhaps, we need to extend the public config to enable/disable the input field.

    Any existing projects that do something similiar?

    opened by chrs1885 1
  • Expose SheetyColors view

    Expose SheetyColors view

    What kind of feature would you like to see?

    In order to use SheetyColors within custom view containers (e.g. custom action sheet, SwiftUI views), we need access to the view representing the color picker.

    How does it work in detail?

    Make SheetyColorsViewController public.

    What does the API look like?

    Any existing projects that do something similiar?

    opened by chrs1885 1
  • Support Swift Package Manager

    Support Swift Package Manager

    What kind of feature would you like to see?

    iOS 13 comes with SPM support which can be used to manage your app's dependencies. SheetyColors should provide support for it as well.

    opened by chrs1885 1
  • Add message label

    Add message label

    What kind of feature would you like to see?

    While regular action sheet controllers do support a message, SheetyColors doesn't. Make this one an optional field of the configuration.

    How does it work in detail?

    Specify the message property inside the config protocol and display the value inside the view.

    What does the API look like?

    Add the message property to the protocol.

    Any existing projects that do something similiar?

    opened by chrs1885 1
  • Feature/4 dark mode

    Feature/4 dark mode

    Issue information

    With iOS 13 dark mode enabled, the color picker doesn't look right anymore.

    Goal

    Adjust images and colors for dark mode

    Implementation

    Bildschirmfoto 2019-08-06 um 15 34 24

    Testing

    Run unit tests

    opened by chrs1885 1
  • iOS 13 support

    iOS 13 support

    Issue information

    The component was lacking iOS 13 support. The color picker view inside the action sheet was rendered transparent.

    Goal

    Support iOS 13 in the same way we supported previous iOS versions

    Implementation

    Instead of replacing the message view of an UIAlertViewControllerwith the color picker view, make use of the contentViewController key path.

    Testing

    Run unit tests.

    opened by chrs1885 1
  • Add custom action sheet extensions (iOS 13 Support)

    Add custom action sheet extensions (iOS 13 Support)

    As a result of #3

    What kind of feature would you like to see?

    Add extensions to make SheetyColors work with other alert view libs. This way devs can add iOS 13 support by choosing any custom alert view for displaying the picker.

    How does it work in detail?

    Add extensions to wrap the SheetyColorsView inside the custom alert view controller.

    What does the API look like?

    Same as the existing API

    Any existing projects that do something similiar?

    opened by chrs1885 1
  • Wrong Hex value displayed after entering Hex code (HSB color space)

    Wrong Hex value displayed after entering Hex code (HSB color space)

    When entering specific Hex values (e.g. #ABCDEF) into the HSB color picker, it will set a different value. The problem is that SheetyColors will fall back to the nearest color that can be represented with integer values only.

    If a user explicitly enters a color with a Hex value, we need to support float values as well.

    opened by chrs1885 0
  • Breaking layout constraints when using picker inside of a custom container

    Breaking layout constraints when using picker inside of a custom container

    What did you do?

    I was trying to present the picker view controller modally (custom view container).

    What did you expect to happen?

    The view gets properly displayed without any warnings.

    What happened instead?

    I got warnings about breaking layout constraints. It seems like the preview color view has a fixed height, therefore I need to provide the exact height for the color picker to work around this issue.

    Setup

    help wanted good first issue 
    opened by chrs1885 0
Releases(1.2.1)
Owner
Christoph Wendt
👨🏼‍💻+👨‍👦 from Karlsruhe, Germany.
Christoph Wendt
ColorWheel Test - An attempt at creating a Color Wheel to be utilized for color picking in SwiftUI utlizing various tutuorials on youtube

This code focuses on creating a Color Wheel in which a user will be able to select a desired color to then be implemented in another project that will display that color in an LED connected to an arduino

Gerardo Cerpa 0 Jan 15, 2022
ChromaColorPicker - An intuitive HSB color picker built in Swift

An intuitive HSB color picker built in Swift. Supports multiple selection handles and is customizable to your needs.

Jonathan Cardasis 536 Dec 29, 2022
A tool to calculate the color ratio of UIImage in iOS.

UIImageColorRatio A tool to calculate the color ratio of UIImage in iOS. How to use UIImageColorRatio Get the color ratio of UIImage. let image = ...

Yanni Wang 王氩 34 Jan 1, 2023
A beautiful set of predefined colors and a set of color methods to make your iOS/OSX development life easier.

Installation Drag the included Colours.h and Colours.m files into your project. They are located in the top-level directory. You can see a demo of how

Ben Gordon 3.1k Dec 28, 2022
iTunes 11 Style Color Art Detection for iOS

iTunes 11 Style Color Art Detection for iOS. Original implementation from Fred Leitz Port of ColorArt code from OS X to iOS. Usage #include <ColorArt/

Vinh Nguyen 132 Dec 14, 2021
HEX color handling as an extension for UIColor. Written in Swift.

SwiftHEXColors HEX color handling as an extension for UIColor. Written in Swift.

Thi Doãn 692 Dec 22, 2022
Convenience methods for creating color using RGBA hex string.

UIColor+Hex, now Swift. Convenience method for creating autoreleased color using RGBA hex string.

R0CKSTAR 1.2k Dec 23, 2022
UIGradient - A simple and powerful library for using gradient layer, image, color

UIGradient is now available on CocoaPods. Simply add the following to your project Podfile, and you'll be good to go.

Đinh Quang Hiếu 247 Dec 1, 2022
Color framework for Swift & Objective-C (Gradient colors, hexcode support, colors from images & more).

Swift 3 To use the Swift 3 version, add this to your Podfile (until 2.2 or higher is released): pod 'ChameleonFramework/Swift', :git => 'https://githu

Vicc Alexander 12.5k Dec 27, 2022
An attractive color generator for Swift. Ported from randomColor.js.

Random Color Swift Inspired by David Merfield's randomColor.js. It is a ported version to Swift. You can use the library to generate attractive random

Wei Wang 624 Jan 3, 2023
Flat UI color palette helpers written in Swift.

FlatUIColors (swift) install Make sure you have the latest version of CocoaPods (gem install cocoapods) that has Swift support. At the time of this wr

Bryn Bellomy 172 Dec 6, 2022
A UIColor extension with CSS3 Color names.

CSS3ColorsSwift Overview CSS3ColorsSwift provides a UIColor extension with Web Color names. Demo Run the demo project in the Demo directory without ca

WorldDownTown 67 Aug 6, 2022
Google Material Color Palette in Swift

Google Material Color in Swift Defined Google Material Color value ready to use in Swift refer to Google Material Design in Style/Color section ###How

Todsaporn Banjerdkit 48 Oct 30, 2019
Generate color based on the given string.

PFColorHash Swift 4.0 SUPPORT! Generate color based on the given string. Thanks to color-hash. Usage Basic let colorHash = PFColorHash() // in HSL, H

null 26 Feb 23, 2022
A Lightweight But Powerful Color Kit (Swift)

BCColor A lightweight but powerful color kit (Swift) Features Pick Colors From Image Generate Monochrome Image Support Hex Color Style Lighten / Darke

Xiaobo Zhang 418 Nov 25, 2022
A simple UIColor category to get color with hex code.

TFTColor A simple UIColor library to get UIColor object from RGB hex string/value, CMYK hex string/value or CMYK base component values. You can also r

Burhanuddin Sunelwala 18 Jun 21, 2022
Aesthetic color-scheme generation written in Swift

Lorikeet Lightweight framework for generating visually aesthetic color-schemes in Swift Requirements UIKit Features What can Lorikeet do for you Calcu

Þorvaldur Rúnarsson 31 Jun 21, 2022
Overrides macOS external display EDIDs to force RGB color

edidiotic edidiotic creates EDID overrides for external displays on macOS that set the display type to RGB color and removes all extension blocks. Thi

William Alexander 1 Dec 21, 2021
HEX color handling as an extension for UIColor

HEX color handling as an extension for UIColor. Written in Swift

Thi Doãn 692 Dec 22, 2022