-
Improvement
-
Resolution: Fixed
-
Minor
-
2.0, 2.4
-
MOODLE_20_STABLE, MOODLE_24_STABLE
-
MOODLE_25_STABLE
-
wip-mdl-23504
-
Easy
-
Colour picker should support also transparent background-color property - theme designers often want to use background-color:transparent instead of some color.
If you add to lib/adminlib.php class admin_setting_configcolourpicker extends admin_setting
{...}/ protected function validate($data) two lines
} else if ($data=='transparent') {
return $data;
so that the validitation could be done with
protected function validate($data) {
if (preg_match('/^#?([a-fA-F0-9]
)
{1,2}$/', $data)) {
if (strpos($data, '#')!==0)
return $data;
} else if (preg_match('/^[a-zA-Z]
$/', $data))
{ return $data; } else if ($data=='transparent') { return $data; }else if (empty($data))
{ return $this->defaultsetting; }else
{ return false; }}
This way theme administrators can write value
transparent
to colour picker input box and it is accepted as valid background-color.
Transparency should of course be used only for background colors (not for text colors) so it could be good to note in docs or some help file about this thing...
- Discovered while testing
-
MDL-37548 Invalid value entered in colour picker displays warning with last value saved shown, rather than the erroneous value.
-
- Closed
-