Test with any color picker in Joomla such as the Protostar Template and try to add the word transparent. Transparent is a CSS color value for background-color and should work. In other frameworks etc custom color pickers are used to get over this issue.
Color value saved as transparent
Defaults to last saved value
Joomla 3x 3.7 etc
Adding this would be part of enabling 3rd party developers to conform to Joomla's API and features.
Labels |
Added:
?
|
Pretty sure transparency was added to the color picker.some time ago but
not at computer to double check.
On 21 Mar 2017 9:01 p.m., "pepperstreet" notifications@github.com wrote:
Good point. Just had a quick look in my local installation. The visual
appearance of the form field implies to support "transparent", because it
shows the typical "checkerboard". My first thought was, it might be some
build-in functionality.
What about using the default value parameter instead? The output is just
the field value. So, you might work with that value "transparent".PS: On the other hand, it results in a "never-empty" field, right? Maybe a
related and general question how to deal with the basic field logic for
"empty" and "filled" fields. Wouldn't it make sense to display labels of
empty fields?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#14843 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPH8XiZzhr2tRN44VUNmrRZCBAmyPRHks5roDqhgaJpZM4MkWGY
.
Category | ⇒ | Templates (site) |
Priority | Medium | ⇒ | Low |
Status | New | ⇒ | Confirmed |
Rel_Number | 0 | ⇒ | 14427 |
Relation Type | ⇒ | Related to |
Category | Templates (site) | ⇒ | Feature Request Templates (site) |
I can confirm this issue. Values returned are either color value or "" .
I'm sure this was fixed in a previous PR.
Just come across this issue however my results are slightly different.
<field name="navbar_bg" type="color" default="#f8f8f8" keywords="transparent,initial,inherit" label="TPL_NAVBAR_BACKGROUND_COLOR_LABEL" description="TPL_NAVBAR_BACKGROUND_COLOR_DESC" />
The above allows me to enter 'transparent' and when I click save the value is stored and can be used in my template view. However the word 'transparent' is not loaded back into the template xml form so when I click 'save' again the default value of #f8f8f8 is stored.
I think I've located the problem,
file: libraries/joomla/form/fields/color.php
line 207
if (!$color || in_array($color, array('none', 'transparent'))) { $color = 'none'; } elseif ($color['0'] != '#') { $color = '#' . $color; }
the above replaces the word 'transparent' with 'none'
the following does work, but not sure if it will be good enough for you guys
if (!$color) { $color = 'none'; } elseif ($color['0'] != '#' && !in_array($color, array('transparent','initial','inherit'))) { $color = '#' . $color; }
idk if this is relevant but I discovered an issue today with it changing colors automatically...
I have two fields in my template...
<field name="hoverbackgroundColor"
class="small-input"
label="TPL_SERENITY_FONTS_HOVER_BACKGROUND_COLOR_LABEL"
description="TPL_SERENITY_FONTS_HOVER_BACKGROUND_COLOR_DESC"
type="color"
default=''
/>
<field name="hoverColor"
class="small-input"
label="TPL_SERENITY_FONTS_HOVER_COLOR_LABEL"
description="TPL_SERENITY_FONTS_HOVER_COLOR_DESC"
type="color"
default=''
/>
you've got 2 fields
if you put color in the 2nd and save it returns empty
if you put color in the 1st it saves
if you put color in the 1st and 2nd it changes 2nd to match first!!!
craziest thing I've ever seen.
Okay, so I'm extending my module so as the user can select one or more background colours to utilise the CSS linear-gradient style.
My fix above no longer works within a repeatable field, in fact as soon as you type 'transparent' into the color field, the word immediately gets replaced with "#rrggbb"
<field name="bg_color2" label="Background Color 2" description="Background colour, other options include transparent, initial & inherit" type="repeatable" icon="list" > <fieldset hidden="true" name="bg_color2_modal" repeat="true"> <field name="bg_color2a" type="color" keywords="transparent,initial,inherit" default="" label="Background Color" description="" /> </fieldset> </field>
Why would this be different from my first example?
Note: just found out that format="rgba" does not appear to work inside a repeatable field. on a 'top level' color field, the colour picker appears with an alpha slider. on a color field within the repeatable fields, the color picker appears without the alpha slider
<field name="bg_color2" label="Background Color 2" description="Background colour, other options include transparent, initial & inherit" type="repeatable" icon="list" keywords="transparent,initial,inherit" > <fieldset hidden="true" name="bg_color2_modal" repeat="true"> <field name="bg_color2a" type="color" keywords="transparent,initial,inherit" default="" format="rgba" label="Background Color" description="Background colour, other options include transparent, initial & inherit" /> </fieldset> </field>
Status | Confirmed | ⇒ | Discussion |
Labels |
Added:
J3 Issue
|
hold on please
it's just another very old one but it still deserve some more investigation
...unfortunately
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-12 08:26:17 |
Closed_By | ⇒ | alikon | |
Labels |
Added:
No Code Attached Yet
Removed: ? |
time to close it
Good point. Just had a quick look in my local installation. The visual appearance of the form field implies to support "transparent", because it shows the typical "checkerboard". My first thought was, it might be some build-in functionality.
What about using the default value parameter instead? The output is just the field value. So, you might work with that value "transparent".
PS: On the other hand, it results in a "never-empty" field, right? Maybe a related and general question how to deal with the basic field logic for "empty" and "filled" fields. Wouldn't it make sense to display labels of empty fields?