All colors, 3 KB

A tiny, fast and accessible color picker for React and Preact.

Trusted by teams at

Small enough to forget
it's even there.

12× lighter than react-color. Hand-tuned color math, hooks only, no classes and no polyfills.

gzipped, the whole thing
3.1 KB
dependencies
0
test coverage, strict TS
100%
color models out of the box
14

Supported color models

HEX, RGB, HSL, HSV.
With or without alpha.

<HexColorPicker />"#2ebee6"
<RgbaColorPicker />{ r: 224, g: 170, b: 34, a: 0.8 }
<HslColorPicker />{ h: 145, s: 68, l: 53 }
<HsvaStringColorPicker />"hsva(268, 80%, 90%, 1)"

Three lines.
That's the API.

  • AccessibleWAI-ARIA roles, full keyboard control
  • Touch-readyWorks with mouse, pen and fingers
  • Tree-shakeableShip only the picker you import
  • TypedStrict TypeScript, types included
App.jsx
import { HexColorPicker } from "react-colorful";

export const App = () => {
  const [color, setColor] = useState("#21d4fd");
  return <HexColorPicker color={color} onChange={setColor} />;
};

react-colorful + colord

One color in.
A whole theme out.

Pick it with react-colorful. Derive hover states, tints and readable text with colord — a 1.8 KB sibling with the same no-deps attitude.

.isLight() → false white text.contrast() 4.44AA Large
  • .mix("#fff", 0.86)
  • .tints() + .shades()
  • .darken(0.1) on hover
  • .lighten(0.3).alpha(0.4)
  • .mix("#fff", 0.93)