Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-color-palette

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-color-palette

Color picker for React

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29K
increased by3.5%
Maintainers
1
Weekly downloads
 
Created
Source

react-color-palette

2KB color picker component for React.

npm downloads size

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} hideHSB dark />;
};

Overriding styles

If the default colors don't fit your project, you can always change them.

Example for the Light theme
.rcp-light {
  --rcp-background: #ffffff;
  --rcp-input-text: #111111;
  --rcp-input-border: rgba(0, 0, 0, 0.1);
  --rcp-input-label: #717171;
}
Example for the Dark theme
.rcp-dark {
  --rcp-background: #181818;
  --rcp-input-text: #f3f3f3;
  --rcp-input-border: rgba(255, 255, 255, 0.1);
  --rcp-input-label: #999999;
}

API

'Color' type

Color

FieldType
hexstring
rgbColorRGB
hsbColorHSB

ColorRGB

FieldType
rnumber
gnumber
bnumber

ColorHSB

FieldType
hnumber
snumber
bnumber

ColorPicker Props

NameTypeDefaultDescription
widthnumberThe width of the color picker.
heightnumberwidthThe height of the color picker.
colorColorThe current Color.
onChangeFunctionThe function that accepts the updated Color as a single argument.
hideHEXboolfalseHide HEX input.
hideRGBboolfalseHide RGB input.
hideHSBboolfalseHide HSB input.
darkboolfalseColor theme.

useColor Arguments

NameTypeDefaultDescription
format"hex" | "rgb" | "hsb"The color format.
initialColorstring | ColorRGB | ColorHSBThe initial color in the selected color format.

toColor Arguments

NameTypeDefaultDescription
format"hex" | "rgb" | "hsb"The color format.
colorstring | ColorRGB | ColorHSBThe color in the selected color format.

License

Code released under the MIT license.

Keywords

FAQs

Package last updated on 25 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc