1.0.1 • Published 2 years ago

react-colors-pickers v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

npm

npm install color-picker-react

yarn

yarn add color-picker-react

Usage

import { ColorPicker, useColor } from "color-picker-react";
import "color-picker-react/lib/css/styles.css";

export const App = () => {
  const [color, setColor] = useColor("hex", "#121212");

  return <ColorPicker width={456} height={228} color={color} onChange={setColor} hideHSV dark />;
};

API

ColorPicker Props

NameTypeDefaultDescription
widthnumberThe width of the color picker.
heightnumberwidthThe height of the color picker.
colorColorThe current Color.
onChangeFunctionA function to update Color.
onChangeCompleteFunctionundefinedA callback is called every time the user stops changing a color (mouseup event).
hideHEXboolfalseHide HEX input.
hideRGBboolfalseHide RGB input.
hideHSVboolfalseHide HSV input.
alphaboolfalseEnable alpha channel.
darkboolfalseColor theme.

useColor Arguments

NameTypeDefaultDescription
model"hex" | "rgb" | "hsv"The color model.
initColorstring | ColorRGB | ColorHSVThe initial color in the selected color model.

toColor Arguments

NameTypeDefaultDescription
model"hex" | "rgb" | "hsv"The color model.
colorstring | ColorRGB | ColorHSVThe color in the selected color model.

Color

FieldType
hexstring
rgbColorRGB
hsvColorHSV

ColorRGB

FieldType
rnumber
gnumber
bnumber
anumber | undefined

ColorHSV

FieldType
hnumber
snumber
vnumber
anumber | undefined

License

Code released under the MIT license.