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 styled-components
yarn
yarn add react-color-palette styled-components
Usage
import React from "react";
import ColorPicker, { useColorObject } from "react-color-palette";
export const App = () => {
const [color, setColor] = useColorObject("hex", "#121212");
return <ColorPicker width={400} color={color} onChange={setColor} />;
};
API
ColorPicker
Prop | Type | Description |
---|---|---|
width | number | The width of the color picker. |
[height] | number | The height of the color picker. |
color | ColorObject |
Color in the ColorObject . |
onChange | (color: ColorObject ) => void |
The function that accepts the updated ColorObject as a single argument. |
useColorObject(model, initialColor)
Param | Type | Description |
---|---|---|
model | ColorModels |
Color model. |
initialColor | ColorObject[model] |
The initial color in the selected color model. |
License
Code released under the MIT license.