Package Exports
- react-color-palette
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-color-palette) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-color-palette
Color picker for React
Demo
Installation
npm
npm install react-color-palette
yarn
yarn add react-color-palette
Usage
import ColorPicker, { useColor } from "react-color-palette";
export const App = () => {
const [color, setColor] = useColor("hex", "#121212");
return <ColorPicker width={456} height={228} color={color} onChange={setColor} dark />;
};
API
Color
Field | Type |
---|---|
hex | string |
rgb | { r: number , g: number , b: number } |
hsb | { h: number , s: number , b: number } |
ColorPicker Props
Name | Type | Default | Description |
---|---|---|---|
width | number |
The width of the color picker. | |
height | number |
width | The height of the color picker. |
color | Color |
The current Color . |
|
onChange | (color: Color ) => void |
The function that accepts the updated Color as a single argument. |
|
dark | bool |
false | Color theme. |
useColor Arguments
Name | Type | Default | Description |
---|---|---|---|
format | "hex" | "rgb | "hsb" | The color format. | |
initialColor | string | ColorRGB | ColorHSB |
The initial color in the selected color format. |
toColor Arguments
Name | Type | Default | Description |
---|---|---|---|
format | "hex" | "rgb | "hsb" | The color format. | |
color | string | ColorRGB | ColorHSB |
The color in the selected color format. |
License
Code released under the MIT license.