aboutsummaryrefslogtreecommitdiffstats
path: root/apps/theming/lib
diff options
context:
space:
mode:
authorJulius Haertl <jus@bitgrid.net>2016-07-25 17:32:11 +0200
committerJulius Haertl <jus@bitgrid.net>2016-07-27 20:00:23 +0200
commitcc457cd6650c1fd3c1cc6f85c961f65de38615d8 (patch)
tree20a782397d7a381ab3f23e3ecee2316e75e9cd5c /apps/theming/lib
parent7ff19e342e8c44def7fe9aeb3a209e91c3ff107e (diff)
downloadnextcloud-server-cc457cd6650c1fd3c1cc6f85c961f65de38615d8.tar.gz
nextcloud-server-cc457cd6650c1fd3c1cc6f85c961f65de38615d8.zip
Theming: Generate colorized radio buttons dynamically
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/controller/themingcontroller.php14
-rw-r--r--apps/theming/lib/util.php10
2 files changed, 14 insertions, 10 deletions
diff --git a/apps/theming/lib/controller/themingcontroller.php b/apps/theming/lib/controller/themingcontroller.php
index 7d828d7798b..6a61293828f 100644
--- a/apps/theming/lib/controller/themingcontroller.php
+++ b/apps/theming/lib/controller/themingcontroller.php
@@ -220,7 +220,7 @@ class ThemingController extends Controller {
'#body-user #header,#body-settings #header,#body-public #header,#body-login,.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid {background-color: %s}' . "\n",
$color
);
- $responseCss .= sprintf('html:not(.ie):not(.edge) input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
+ $responseCss .= sprintf('input[type="checkbox"].checkbox:checked:enabled:not(.checkbox--white) + label:before {' .
'background-image:url(\'%s/core/img/actions/checkmark-white.svg\');' .
'background-color: %s; background-position: center center; background-size:contain;' .
'width:12px; height:12px; padding:0; margin:2px 6px 6px 2px; border-radius:1px;' .
@@ -228,15 +228,9 @@ class ThemingController extends Controller {
\OC::$WEBROOT,
$elementColor
);
- $responseCss .= sprintf('html:not(.ie):not(.edge) input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
- '-webkit-mask-image: url(\'%s/core/img/actions/radio-checked-white.svg\');' .
- '-webkit-mask-repeat: no-repeat;' .
- 'background-color: %s;' .
- 'background-image: none; '.
- "}\n",
- \OC::$WEBROOT,
- $elementColor
- );
+ $responseCss .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
+ 'background-image: url(\'data:image/svg+xml;base64,'.Util::generateRadioButton($elementColor).'\');' .
+ "}\n";
}
$logo = $this->config->getAppValue($this->appName, 'logoMime');
if($logo !== '') {
diff --git a/apps/theming/lib/util.php b/apps/theming/lib/util.php
index e83d854b997..f0ce30ac5ba 100644
--- a/apps/theming/lib/util.php
+++ b/apps/theming/lib/util.php
@@ -71,4 +71,14 @@ class Util {
return (0.299 * $r + 0.587 * $g + 0.114 * $b)/255;
}
+ /**
+ * @param $color
+ * @return string base64 encoded radio button svg
+ */
+ public static function generateRadioButton($color) {
+ $radioButtonIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">' .
+ '<path d="M8 1a7 7 0 0 0-7 7 7 7 0 0 0 7 7 7 7 0 0 0 7-7 7 7 0 0 0-7-7zm0 1a6 6 0 0 1 6 6 6 6 0 0 1-6 6 6 6 0 0 1-6-6 6 6 0 0 1 6-6zm0 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8z" fill="'.$color.'"/></svg>';
+ return base64_encode($radioButtonIcon);
+ }
+
}