A lightweight and elegant JavaScript color picker written in vanilla JavaScript. Zero dependencies, fully customizable, and accessible.
Written in vanilla ES6 with no external dependencies. Lightweight and fast.
Just add a data-colorpicker attribute to any input field and you're ready to go.
Multiple themes, color formats, swatches, and configuration options.
Built with accessibility in mind, supporting keyboard navigation and screen readers.
Optimized for touch devices. Works great on tablets and smartphones.
Works on all modern browsers with JavaScript support. No polyfills needed.
Try different configurations and see ColorPicker in action.
Add a color picker to your project in minutes.
Add the stylesheet and script to your page.
Browser (IIFE)
<link rel="stylesheet" href="colorpicker.css"/> <script src="colorpicker.min.js"></script>
ES Module
<link rel="stylesheet" href="colorpicker.css"/> <script type="module"> import ColorPicker from 'colorpicker.js'; </script>
Add the data-colorpicker attribute to any input field you want to convert into a color
picker.
<input type="text" data-colorpicker>
Customize the appearance and behavior of the color picker.
ColorPicker({ theme: 'default', format: 'hex', alpha: true, onChange: (color, el) => { console.log(`New color: ${color}`); } });