Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On the field settings page, in the Style section, for the "Background Color" and "Border Color" fields, each has a prefix of "#", and each has help text that mentions an example value of "FFFFFF". All of this suggests that the user does not need to include any "#" in the value entered. However, omitting the "#" causes the value to be ignored.
Comment | File | Size | Author |
---|---|---|---|
#1 | fix_color_styles_for_canvas-2019887-1.patch | 1.02 KB | lirantal |
Comments
Comment #1
lirantal CreditAttribution: lirantal commentedI can confirm the issue.
This happens because the color code is handed out to jQuery's .css() function which hopes to apply a full color code notation, such as "#FF0000" or "rgb()", yet the hex color code is provided without the hash prefix.
While the problem seems at first an issue to add the "#" prefix on hex colors notation due to the input field length limit of 6 characters, the workaround is simply to provide the hex color code short notation, i.e: "#F00".
Attached is a patch to fix the issue. It appends the hash prefix before it hands it out to jQuery's CSS.
Comment #2
lirantal CreditAttribution: lirantal commentedComment #3
mjross CreditAttribution: mjross commentedThe patch worked. Thank you, Liran!