πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’

react-colorful

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
r

react-colorful

🎨 A tiny (2,8 KB) color picker component for React and Preact apps. Fast, well-tested, dependency-free, mobile-friendly and accessible

5.6.1
latest
99

Supply Chain Security

100

Vulnerability

100

Quality

77

Maintenance

100

License

Version published
Weekly downloads
3.5M
2.1%
Maintainers
1
Weekly downloads
 
Created
Issues
41

What is react-colorful?

The react-colorful package is a tiny (approximately 1.5 KB) color picker component for React applications that is fast and without dependencies. It provides a modern, accessible, and extensible color picking solution that can be easily integrated into any React project.

What are react-colorful's main functionalities?

Hex Color Picker

This feature allows users to pick a color using a hex color picker. The component manages the color state and provides a callback for when the color changes.

{"import { HexColorPicker } from 'react-colorful';\n\nfunction App() {\n  const [color, setColor] = useState('#aabbcc');\n\n  return <HexColorPicker color={color} onChange={setColor} />;\n}"}

RGB Color Picker

This feature provides an RGB color picker where users can select a color based on its red, green, and blue components. The color state is managed by the component and updates are provided through a callback function.

{"import { RgbColorPicker } from 'react-colorful';\n\nfunction App() {\n  const [color, setColor] = useState({ r: 170, g: 187, b: 204 });\n\n  return <RgbColorPicker color={color} onChange={setColor} />;\n}"}

HSL Color Picker

This feature enables users to pick a color using HSL (Hue, Saturation, Lightness) values. The component allows for the selection of HSL values and provides updates through a change callback.

{"import { HslColorPicker } from 'react-colorful';\n\nfunction App() {\n  const [color, setColor] = useState({ h: 210, s: 50, l: 60 });\n\n  return <HslColorPicker color={color} onChange={setColor} />;\n}"}

Custom Color Picker

This feature allows for the creation of custom color pickers using the react-colorful library. Users can define their own UI and logic for the color picker while still leveraging the underlying functionality provided by react-colorful.

{"import { CustomPicker } from 'react-colorful';\nimport { useState } from 'react';\n\nconst MyColorPicker = CustomPicker(({ hex, onChange }) => (\n  <div>\n    <div style={{ backgroundColor: hex, width: '100px', height: '100px' }} />\n    <input value={hex} onChange={(e) => onChange(e.target.value)} />\n  </div>\n));\n\nfunction App() {\n  const [color, setColor] = useState('#aabbcc');\n\n  return <MyColorPicker color={color} onChange={setColor} />;\n}"}

Other packages similar to react-colorful

FAQs

Package last updated on 18 Aug 2022

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