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

🎨 Lightweight Color Picker component for React.

  • 5.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
react-color-palette
npm downloads size
🎨 Lightweight Color Picker component for React.

Features

  • 🚀 Lightweight (3.5KB).
  • 💨 No dependencies.
  • 🛡️ Strict (written in TypeScript).

Installation

npm

npm install react-color-palette

yarn

yarn add react-color-palette

Usage

import { ColorPicker, useColor } from "react-color-palette";
import "react-color-palette/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 />;
};

Benchmarks

LibraryMinifiedGzippedDependencies
react-color-palette
react-colorful
react-input-color
rc-color-picker
react-color

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

ColorPicker Props

NameTypeDefaultDescription
widthnumberThe width of the color picker.
heightnumberwidthThe height of the color picker.
colorColorThe current Color.
onChangeFunctionA function to update Color.
hideHEXboolfalseHide HEX input.
hideRGBboolfalseHide RGB input.
hideHSVboolfalseHide HSV input.
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

ColorHSV

FieldType
hnumber
snumber
vnumber

License

Code released under the MIT license.

Keywords

FAQs

Package last updated on 28 Apr 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