Cordova plugin to display a native color-picker dialog

Overview

Color Picker Plugin for Cordova (cordova-plugin-color-picker)

Description

This plugin allows you to display a color-picker native dialog in iOS and Android. You can control certain properties of the dialog to be displayed, such as whether to show an alpha-level slider or the initial color picked. Inputs and outputs use the HTML color hex syntax, e.g. #F8F8F8

Example:

let color = '#F8F8F8';
cordova.plugins.colorPicker.showDialog({ 
    color,
    withAlpha: false 
}, (result) => {
    console.log(`New color: ${result.color}`);
}, (error) => {
    console.log(`Something went wrong: ${error}`);
});

Installation

cordova plugin add cordova-plugin-color-picker

Supported platforms

  • Android
  • iOS

iOS Notes

The native dialog for iOS relies on UIColorPickerViewController which is only available on iOS 14 or newer. You can check if the current device supports the feature by calling the isSupported function in the plug-in.

Android Notes

The native dialog for Android relies on https://github.com/QuadFlask/colorpicker

Methods

isAvailable

Checks whether the device supports showing the color picker dialog. Currently this always return true on Android. On iOS it will return true only if the device is running iOS 14 or later

cordova.plugins.colorPicker.isAvailable((available) => {
    if (available) {
        console.log('Color picker is available');
    } else {
        console.log('Color picker is NOT available');
    }
}, (error) => {
    console.log(`Something went wrong: ${error}`);
});

showDialog

Displays the color selection dialog and returns the color picked by the user.

let color = '#F8F8F8';
cordova.plugins.colorPicker.showDialog({ 
    color,
    withAlpha: false 
}, (result) => {
    console.log(`New color: ${result.color}`);
}, (error) => {
    console.log(`Something went wrong: ${error}`);
});

The options available are:

  • title: The string to show as title of the dialog. Defaults to 'Choose color'
  • color: The initial color to pick. Defaults to '#FFFFFF'
  • withAlpha: Whether to display the alpha slider. Defaults to false

The result object has the following values:

  • color: The color picked by the user. If the initial option withAlpha was set to true the alpha level will be the first 2 hex characters of the string. For example, black color with 100% opacity: '#FF000000'
You might also like...
Small color quantizer for bitmaps without any dependencies or use of frameworks

MicroColorQuantizer This package currently offers a very simple color quantizer

The first non-jailbroken iOS (and macOS) application to adjust the screen temperature, brightness, and color!

GoodNight Project name thanks to @Emu4iOS. Based off of Thomas Finch's GammaThingy. GoodNight is an app that allows you to directly access the screen'

Globally change the appearance of the application. Light/Dark mode and color.
Globally change the appearance of the application. Light/Dark mode and color.

About I tried to create a project where you can globally change the appearance of the application. Perhaps someone was looking for such a solution. ⭐️

FacebookImagePicker is Facebook album photo picker written in Swift.
FacebookImagePicker is Facebook album photo picker written in Swift.

Features • Installation • Usage • Translation • License GBHFacebookImagePicker is Facebook's album photo picker written in Swift, built to provide a s

FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor
FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor

FMPhotoPicker is a modern, simple and zero-dependency photo picker with an elegant and customizable image editor Quick demo Batch select/deselect Smoo

📸 Instagram-like image picker & filters for iOS
📸 Instagram-like image picker & filters for iOS

YPImagePicker YPImagePicker is an instagram-like photo/video picker for iOS written in pure Swift. It is feature-rich and highly customizable to match

Image picker with custom crop rect for iOS written in Swift (Ported over from GKImagePicker)
Image picker with custom crop rect for iOS written in Swift (Ported over from GKImagePicker)

WDImagePicker Ever wanted a custom crop area for the UIImagePickerController? Now you can have it with WDImagePicker. Just set your custom crop area a

📸 iMessage-like, Image Picker Controller Provides custom features.

RAImagePicker Description RAImagePicker is a protocol-oriented framework that provides custom features from the built-in Image Picker Edit. Overview O

📷 multiple phassets picker for iOS lib. like a facebook
📷 multiple phassets picker for iOS lib. like a facebook

Written in Swift 5.0 TLPhotoPicker enables application to pick images and videos from multiple smart album in iOS, similar to the current facebook app

Owner
Antonio Vargas
Antonio Vargas
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021
Cordova plugin for detect screenshots and recordings

cordova-plugin-detect-screen-capture This plugin detects screen recording and screenshot events. The plugin will only work on devices with iOS >= 7 Su

Sasha 0 Nov 4, 2021
Touch ID Plugin (Cordova) for iOS

cordova-plugin-gctouch-id Touch ID Plugin (Cordova) for iOS Author: Giulio Caruso aka rdn Index Description Technical Documentation Screenshots Adding

Giulio Caruso 20 Jan 3, 2022
Make system color defined in UIColor/NSColor available to SwiftUI Color.

SwiftUIColor Make system color defined in UIColor/NSColor available to SwiftUI Color. About In this library, colors are defined in an asset file. Crea

null 2 Oct 24, 2022
XcodeColorSense - An Xcode plugin that makes working with color easier.

XcodeColorSense An Xcode plugin that makes working with color easier. Inspired by ColorSense-for-Xcode with extra care for Hex color Features Show col

Khoa 77 Jul 1, 2022
Xcode-streamdeck-plugin - A Stream Deck plugin for Xcode

Stream Deck Xcode Plugin This repository contains a Stream Deck plugin to add so

Daniel Kennett 77 Dec 27, 2022
React-native-photo-editor - Photo editor using native modules for iOS and Android

?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, ZLImageEditor (iOS) and PhotoEditor (Android)

Baron Ha. 244 Jan 5, 2023
Random image and background color with swift

Random-image-and-background-color Hello, this is my first project. Frankly, I got this idea from the "IOS Academy" page, but: color scale for the back

imhalid 2 Apr 12, 2022
SwiftColorArt is a demo application that includes Swift files with all classes and extension necessary to create a font color schema matching to an image

SwiftColorArt SwiftColorArt is a demo application that includes Swift files with all classes and extension necessary to create a font color schema mat

Jan Gregor Triebel 264 Jan 4, 2023
🎨 Mondrian is lightweight Swift package that provides a universal basis for your design system's color palette.

??‍?? Mondrian Mondrian provides a universal basis on which to build your design system's color palette right from your codebase. With support for all

Klaas Schoenmaker 1 Nov 24, 2021