I ran into an issue with the formatters showing an incorrect color only when opacity was being recorded on the field. Whenever I had a color field with opacity being recorded, the color swatch that got rendered was a completely different color than the one I selected. I don't really know why this was only an issue when opacity was being recorded, but I solved it anyhow.

The issue also affected other formatters (all of them). I tracked it down to the color_field_hex2rgb() function, which somehow was not taking the "#" of the hex value into account (it was not expecting # to be in the string). It was expecting only 6 integers in the string, but was getting 7. I adjusted the hexdec(substr() calls accordingly.

I assume somewhere along the line # started being included in the RGB values, and this function just needed to be updated accordingly.

Patch attached.

Comments

caspervoogt’s picture

Issue summary: View changes
caspervoogt’s picture

Issue summary: View changes
StatusFileSize
new525 bytes
caspervoogt’s picture

Issue summary: View changes
caspervoogt’s picture

Status: Active » Needs review
sdstyles’s picture

Status: Needs review » Reviewed & tested by the community

I had same issue, this patch fixed it. Thanks.

caspervoogt’s picture

glad to hear it

caspervoogt’s picture

so is this RTBC / is it in the dev branch now?

  • targoo committed 44abfc0 on 7.x-2.x authored by caspervoogt
    Issue #2469167 by caspervoogt: Wrong color when opacity is set
    
targoo’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Hi,

Thanks. It's now been merge to the dev branch.

David.

caspervoogt’s picture

requesting credit for this patch - not sure how to go about that. Getting used to this new contribution/credit setup. Somehow on my organization page it just shows "Contributed to fixing 1 issue in the past 3 months" when it should be 2 or 3 items.

targoo’s picture

StatusFileSize
new131.92 KB

trying to give you also the credit..

caspervoogt’s picture

cool - thanks! That worked