All Projects β†’ instea β†’ React Native Color Picker

instea / React Native Color Picker

Licence: apache-2.0
Color picker component for IOS/Android

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Native Color Picker

Verte
🎨 A Color picker component. Built from the bottom to work with Vue.js.
Stars: ✭ 117 (-47.06%)
Mutual labels:  color-picker
Flexcolorpicker
Modern color picker library written in Swift 5 that can be easily extended and customized. It aims to provide great UX and performance with stable, quality code.
Stars: ✭ 164 (-25.79%)
Mutual labels:  color-picker
Flutter colorpicker
A HSV(HSB)/HSL color picker inspired by chrome devtools and a material color picker for your flutter app.
Stars: ✭ 185 (-16.29%)
Mutual labels:  color-picker
Alderis
iOS color picker library
Stars: ✭ 128 (-42.08%)
Mutual labels:  color-picker
Colorbook
🎨 Color schemes for UI design - Optimized for foreground, background, border, etc. https://liyasthomas.github.io/colorbook
Stars: ✭ 148 (-33.03%)
Mutual labels:  color-picker
React Native Color
Color components for React Native 🌈
Stars: ✭ 178 (-19.46%)
Mutual labels:  color-picker
Colorwanted
Screen color picker for Windows (Windows δΈŠηš„ε±εΉ•ε–θ‰²ε™¨)
Stars: ✭ 105 (-52.49%)
Mutual labels:  color-picker
Xcolor
Lightweight color picker for X11
Stars: ✭ 209 (-5.43%)
Mutual labels:  color-picker
Mscolorpicker
Color picker component for iOS
Stars: ✭ 162 (-26.7%)
Mutual labels:  color-picker
Jscolor
JavaScript color picker with opacity (alpha channel) and customizable palette. Single file of plain JS with no dependencies.
Stars: ✭ 182 (-17.65%)
Mutual labels:  color-picker
React Native Color Wheel
🌈 A react native reusable and color picker wheel
Stars: ✭ 137 (-38.01%)
Mutual labels:  color-picker
Pikolo
An android color picker library
Stars: ✭ 142 (-35.75%)
Mutual labels:  color-picker
Colorsheet
A color picker bottom sheet 🌈
Stars: ✭ 179 (-19%)
Mutual labels:  color-picker
Colordrop
Interactive Drag & Drop Coloring with Material Design Color palette
Stars: ✭ 120 (-45.7%)
Mutual labels:  color-picker
Huekit
A UI framework for iOS that provides components and utilities for building color pickers.
Stars: ✭ 198 (-10.41%)
Mutual labels:  color-picker
React Color
🎨 Color Pickers from Sketch, Photoshop, Chrome, Github, Twitter & more
Stars: ✭ 10,287 (+4554.75%)
Mutual labels:  color-picker
Angular Color Picker
Vanilla AngularJS Color Picker Directive with no requirement on jQuery
Stars: ✭ 173 (-21.72%)
Mutual labels:  color-picker
Androidphotoshopcolorpicker
A fully featured Color picker Library for Android
Stars: ✭ 220 (-0.45%)
Mutual labels:  color-picker
React Input Color
React color picker
Stars: ✭ 208 (-5.88%)
Mutual labels:  color-picker
React Colorpickr
A themeable colorpicker with HSL and RGB support for React
Stars: ✭ 180 (-18.55%)
Mutual labels:  color-picker

react-native-color-picker

React Native implementation of color picker for both Android and iOS.

android preview iphone preview

  • [x] works both in controlled and uncontrolled way
  • [x] old color can be displayed for visual comparison
  • [x] holo and triangle color pickers

Getting started

Install the color picker

npm install react-native-color-picker --save

And use it in your application

import { ColorPicker } from 'react-native-color-picker'

const Picker = () => (
  <ColorPicker
    onColorSelected={color => alert(`Color selected: ${color}`)}
    style={{flex: 1}}
  />
)

Color picker will use space you provide. Therefore it is necessary to provide styles that will determine picker's size.

For HoloPicker (ColorPicker) you might need to install @react-native-community/slider and pass it (or any other Slider compatible component) as sliderComponent prop if you don't want to use deprecated RN Slider.

API

Color picker type

We provide two types of color picker - holo (default) and triangle color picker. Both has the same API so that they are interchangable. Just import it and use it the same way:

import { ColorPicker, TriangleColorPicker } from 'react-native-color-picker'
ColorPicker TriangleColorPicker

Props

Color pickers accepts properties below. Each property which define color is represented as a color string.

Both color pickers are PureComponents thus if you want to update it you should not mutate its properties deeply.

Property Type Note
color String|HSV Color string or HSV object (see below). Defines selected color in controlled component.
defaultColor String Defines initial selected color in uncontrolled component.
oldColor String Old color to be used for visual comparision. If it is not defined, whole circle is representing selected color.
style Style Styles passed to color picker container
onColorSelected Function Callback with color (HEX string) as argument called when user confirms color selection.
onColorChange Function Callback called each time when color is changed. Used in controlled component. Argument is color in HSV representation (see below)
onOldColorSelected Function Callback with color (HEX string) as argument called when user selects old color.
hideSliders Boolean Option to hide bottom sliders (holo picker only)
hideControls Boolean Option to hide bottom buttons (triangle picker only)

When using color picker as a controlled component you should always use HSV color representation to avoid conversion from/to HEX or RGB. HSV color representation is an object literal with properties:

{
  h: number, // <0, 360>
  s: number, // <0, 1>
  v: number, // <0, 1>
}

Helper functions

To utilize HSV -> HEX/RGB conversion we provide helper functions:

import { toHsv, fromHsv } from 'react-native-color-picker'

toHsv('blue') // { h: 24, s: 1, v: 1 }

fromHsv({ h: 200, s: 0.4, v:0.4 }) // #3d5866

Examples

See our examples on Expo

Limitations

  • Does not work well within ScrollView due to touch event interference.
  • RN has deprecated Slider component. You need to provide Slider component as prop to overcome this.
  • There is known bug affecting RN 0.61. See more info about the workaround.

Thanks

Our implementation was inspired by Android Holo ColorPicker

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].