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

react-color

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-color

A Collection of Color Pickers from Sketch, Photoshop, Chrome & more

  • 2.13.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-0.97%
Maintainers
1
Weekly downloads
 
Created

What is react-color?

The react-color npm package is a collection of color pickers for React applications. It provides a variety of UI components that allow users to select and manipulate colors in a user-friendly way. It supports different color models (RGB, HSL, etc.) and offers customizable styles and interfaces.

What are react-color's main functionalities?

Color Picker Components

react-color provides various color picker components like SketchPicker, which can be easily integrated into a React application to allow users to pick colors.

import { SketchPicker } from 'react-color';

function App() {
  const [color, setColor] = useState('#fff');

  const handleChangeComplete = (color) => {
    setColor(color.hex);
  };

  return (
    <SketchPicker
      color={color}
      onChangeComplete={handleChangeComplete}
    />
  );
}

Customizable Styles

The components provided by react-color can be styled and customized to fit the design of the application. Users can adjust dimensions, colors, and more.

import { PhotoshopPicker } from 'react-color';

function App() {
  const [color, setColor] = useState('#fff');

  const styles = reactCSS({
    'default': {
      picker: {
        width: '300px',
        height: '400px',
      },
    },
  });

  return (
    <div style={ styles.picker }>
      <PhotoshopPicker
        color={color}
        onChangeComplete={(color) => setColor(color.hex)}
      />
    </div>
  );
}

Color Representation

react-color supports different color representations such as HEX, RGB, and HSL. Users can work with the color model that best suits their needs.

import { CompactPicker } from 'react-color';

function App() {
  const [color, setColor] = useState({ r: 255, g: 0, b: 0, a: 1 });

  return (
    <CompactPicker
      color={color}
      onChangeComplete={(color) => setColor(color.rgb)}
    />
  );
}

Other packages similar to react-color

Keywords

FAQs

Package last updated on 07 Sep 2017

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