This project is not covered by Drupal’s security advisory policy.
Color Pickr adds a color field to Drupal with a fast, accessible color picker and seven ways to display the chosen color. The picker is built into the module: no external library, CDN or Composer package is needed.
Use it for brand colors, category colors, background and text colors, status labels, palettes, or anything else editors should choose visually instead of typing a color code.
Features
- Built-in color picker with a color area, hue and opacity sliders, and three styles: Classic, Monolith and Nano.
- Eyedropper that picks the exact color of any point on the page (text, images, gradients), like the browser's DevTools color picker.
- Swatches for quick selection: site-wide, per field, or none. A field can be limited to its swatch colors only.
- Recently used colors, remembered in the browser.
- Any color format as input: HEX, RGB(A), HSL(A), HSVA, CMYK and CSS color names.
- Choice of saved format: HEX, HEX with alpha, RGBA or HSLA, with or without transparency.
- Popup or always visible picker, with an optional hidden text field for a cleaner form.
- Accessible: full keyboard support, ARIA labels and screen reader announcements. Works with mouse and touch.
- Secure: colors are validated on save and sanitized on output, so stored values can not inject CSS.
- Single or multiple values, and works in AJAX forms such as Add another item.
- Compatible with Drupal 10, 11 and 12.
Display formatters
- Default: the color code as text, in the format of your choice.
- Badge: the color code on a pill filled with the color, with readable text.
- Square, Circle, Rectangle, Hexagon: a shape filled with the color, with a size setting and an optional color code.
- Line: a full-width line, with a thickness setting.
Translucent colors are shown over a checkerboard, and every formatter can be themed by copying its Twig template into your theme.
Post-installation
- Add a field of type Color Pickr to any content type or entity (Structure » Content types » Manage fields).
- On Manage form display, choose the picker style, saved format, transparency, swatches and eyedropper.
- On Manage display, choose one of the seven formatters.
- Optionally, set the site-wide swatches at Configuration » User interface » Color Pickr.
Upgrading from 1.1.x
Version 2.0.0 keeps your fields, saved colors and settings. Run drush updb after updating. If you customized the old Pickr library with your own JavaScript or CSS, review those changes, because the Pickr library has been replaced. See the 2.0.0 release notes for details.
Requirements
Drupal core 10, 11 or 12. No other modules or libraries.
Similar projects
Color Field offers several widgets based on HTML5 and third-party libraries. Color Pickr focuses on a single built-in picker with an eyedropper, site-wide swatches and shape formatters, with no external dependencies.
Support
Report bugs and request features in the issue queue. Patches and merge requests are welcome.
Project information
- Project categories: Content editing experience, Developer tools, Site structure
781 sites report using this module
- Created by sujan shrestha on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.








