Socket
Socket
Sign inDemoInstall

react-color

Package Overview
Dependencies
12
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-color

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


Version published
Weekly downloads
1.2M
increased by1.29%
Maintainers
1
Install size
9.09 MB
Created
Weekly downloads
 

Package description

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

Readme

Source

React Color

Npm Version Build Status License Downloads

  • 13 Different Pickers - Sketch, Photoshop, Chrome and many more

  • Make Your Own - Use the building block components to make your own

Demo

Demo

Live Demo

Installation & Usage

npm install react-color --save

Include the Component

import React from 'react'
import { SketchPicker } from 'react-color'

class Component extends React.Component {

  render() {
    return <SketchPicker />
  }
}

You can import AlphaPicker BlockPicker ChromePicker CirclePicker CompactPicker GithubPicker HuePicker MaterialPicker PhotoshopPicker SketchPicker SliderPicker SwatchesPicker TwitterPicker respectively.

100% inline styles via ReactCSS

Keywords

FAQs

Last updated on 28 Oct 2020

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