Is there a way to get MD Color Picker to output RGB colors instead of HEX? I poked through the fieldtype code but nothing I tried worked. The field displayed “[object Object]” when I changed this line from:
$("input[name='.$this->field_name.']").val(hex);to this:
$("input[name='.$this->field_name.']").val(rgb);and this line from:
$("input", cell).val(hex);to this:
$("input", cell).val(rgb);The preceding line in both instances was:
onSubmit: function(hsb, hex, rgb) {so I had assumed the value was available but apparently not. Any ideas?
So it’s years since you asked but I just wondered exactly this. Since I just got it working I thought I’d best post the answer in case anyone else needs it.
The javascript stores the rgb values as an object, so you need to get each of the properties for red, green and blue separately and output them together as a string. This outputs them with a comma between them:
$("#'.$field_name.'").val(rgb.r + "," + rgb.g + "," + rgb.b);This replaces line 54 of the PHP, which is currently this:
$("#'.$field_name.'").val(hex);Hope that helps someone.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.