The current implementation of the field doesn't allow for alpha values (either #00000000 - 8 characters) or an RGB implementation such as { r: 0, g: 82, b: 148, a: 0.75 }.

This is possible using the same color picker (http://labs.abeautifulsite.net/jquery-minicolors/#demos). Just needs to be integrated into the module.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

laughnan’s picture

Status: Active » Needs review
FileSize
7.48 KB

Patch for adding a new RGBA field widget.

- Changed the field to include a second column for alpha (not required, defaults to 1.0 which is completely opaque).
- Added a new widget for the minicolors alpha support
- Updated the minicolors widget alter and added another JS file to handle alpha

laughnan’s picture

Issue summary: View changes
laughnan’s picture

Updated patch. Displayed the widget incorrectly for multiple values of the colorfield picker. This fixes that.

digitoolmedia’s picture

given that I am not an expert in Drupal code, I applied the patch to manage the opacity, but the result I get when I use the widget 'Color code with Alpha' is to delete the record in field_data_field_COLORFIELD_NAME table for the node where it is used.
The problem is saving, not the recovery of rgb/opacity, if I manually create such a record.
MiniColor widget works well.

laughnan’s picture

that's great feedback @digitoolmedia!

laughnan’s picture

Status: Needs review » Needs work
laughnan’s picture

Assigned: Unassigned » laughnan
texas-bronius’s picture

Is this true only for existing content? And on next save, does it actually retain RGB and Alpha? Does it maybe work out of the box when installed fresh and only break on existing installations when the patch is applied? Is there maybe a schema update missing from a hook_update_n?