jquery_screenshot.png

🇺🇦

This module is maintained by Ukrainian developers.
Please consider supporting Ukraine in a fight for their freedom and safety of Europe.

Concept

This module creates a new Form API element type, jquery_colorpicker, as well as a Field API color field. This module relies on the 3rd party integration of the jquery colorpicker.

Versions

When the Drupal 6 version of the Jquery Colorpicker module was integrated with CCK (the precursor to the Field API), a new field type 'jquery_colorpicker' was created. This was persisted into Drupal 7 and Drupal 8.

However, upon a close self-reflection, it was realized that the field itself was actually storing a color, and Jquery Colorpicker was simply a widget for that color. The field has always stored a hexadecimal color value, and therefore the field type would be more correctly Color, rather than Jquery Colorpicker.

As such, version 8.x-2.x has been a fairly major re-write of the module, removing the entire underlying field type, and instead making this module simply a widget on top of a colorapi_color field, provided by the Color API module (https://www.drupal.org/project/colorapi).

The module is also now fully managed through Composer, meaning that the 3rd party library dependency is installed through composer, rather than requiring manual download and installation.

Version 8.x-1.x will not receive any more updates with the exception of security updates or serious bug fixes, should something arise. The focus here is on getting users to upgrade to 8.x-2.x.

Installation Instructions

  1. Download code base and dependencies: composer require drupal/jquery_colorpicker:^2.0
  2. Install the module as you would any Drupal module

Upgrade Instructions

To upgrade from 8.x-1.x to 8.x-2.x, do the following:

  1. Update the module to 8.x-1.4 (most recent 8.x-1.x branch).
  2. Take a database backup.
  3. Run composer require 'drupal/jquery_colorpicker:^2.0'.
  4. Enable the Color API module
  5. Run update.php
  6. Review that the update proceeded correctly
  7. Remove the /libraries/jquery_colorpicker folder, as it is no longer needed.

Note: Content editors may need to clear their browser cache after this update. If getting errors on pages when editing fields with JQuery Colorpicker enabled, clearing the browser cache should be the first step. Hold shift while clicking the browser refresh button.

If at any point the upgrade fails, restore your database backup, revert to version 8.x-1.x of the module, and open up a ticket in the issue queue providing specifics including the steps taken and any error messages.

Graceful Degradation

This module is set to gracefully degrade to a text input if the user has JavaScript disabled.

Alternatives

You may also want to check out the Colorpicker module which does essentially the same thing using the Farbtastic JavaScript library.

Development

JQuery Colorpicker was built by Jaypan. We are a development agency specializing in AJAX heavy applications.

Supporting organizations: 
Drupal 8/9 maintenance and development
Drupal 9 testing, maintenance
Support, Bug Fixing

Project information

Releases