Socket
Socket
Sign inDemoInstall

@nivoda/react-color-palette

Package Overview
Dependencies
61
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nivoda/react-color-palette

🎨 Lightweight Color Picker component for React.


Version published
Weekly downloads
83
decreased by-23.85%
Maintainers
4
Created
Weekly downloads
 

Readme

Source
react-color-palette
npm downloads size
🎨 Lightweight <ColorPicker /> component for React.

Features

  • 🚀 Lightweight.
  • 💨 No dependencies.
  • 🛡️ Strict.

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

LibraryMinifiedGzippedDependenciesTree ShakingType Declarations
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.
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.

Keywords

FAQs

Last updated on 23 Mar 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc