# react-color-range

> Super tiny color input ranges for react

Latest version **0.2.5** (published 2022-05-03) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install react-color-range
pnpm add react-color-range
yarn add react-color-range
bun add react-color-range
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2022-05-03 |
| First published | 2022-01-08 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Javier Bórquez |
| Maintainers | javierbyte |
| Keywords | react, color, input, color, picker, react-component, colorpicker |

## Links

- npm: https://www.npmjs.com/package/react-color-range
- npm.io page: https://npm.io/package/react-color-range

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.5 (latest) — 2022-05-03
- 0.2.4 — 2022-01-11
- 0.2.3 — 2022-01-10
- 0.2.2 — 2022-01-09
- 0.2.1 — 2022-01-09
- 0.2.0 — 2022-01-09
- 0.1.5 — 2022-01-08
- 0.1.4 — 2022-01-08
- 0.1.3 — 2022-01-08
- 0.1.2 — 2022-01-08
- 0.1.1 — 2022-01-08
- 0.1.0 — 2022-01-08

## README

# react-color-range &middot; [![](https://badgen.net/bundlephobia/minzip/react-color-range@latest)](https://bundlephobia.com/package/react-color-range)

Tiny color input for React, made with native input ranges. `react-color-range`
leverages the native `input type="range"` and CSS linear gradients to reduce the
bundle size.

[![react-blur](./website/public/react-color-range.jpg)](https://javier.xyz/react-color-range/)

## Usage

```jsx
import { HueSelector } from 'react-color-range';
import 'react-color-range/style.css';

[...]

// with hex colors
<HueSelector
  value={colorHex}
  onChange={color => {
    changeColorHook(color.hex); // also `color.hsl`, `color.h`, `color.s` and `color.l`
  }}
/>

<SaturationSelector
  value={colorHex}
  onChange={color => {
    changeColorHook(color.hex);
  }}
/>

<LuminositySelector
  value={colorHex}
  onChange={color => {
    changeColorHook(color.hex);
  }}
/>
```

Each of the three components accepts the following props:

- `value`: Either a hex color (example: `#FFFFFF`) or hsl color expressed with
  degrees for hue and percentages for saturation and luminosity separated by
  commas (example: `hsl(0, 100%, 50%)`). Please note that using hsl colors as
  the source is preferred to prevent color resolution lost on high and low
  luminosities.
- `onChange`: Function that will return an object when the color is changed.
  - On change response: And object with the following properties:
    - `hsl`: String. New hsl color
    - `hex`: String. New hex color
    - `h`, `s`, `l`: Int. Hue, saturation and luminosity, components of the hsl
      color

---
_Source: https://npm.io/package/react-color-range · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
