summaryrefslogtreecommitdiffstats
path: root/apps/theming/js
diff options
context:
space:
mode:
authorJulius Haertl <jus@bitgrid.net>2016-07-19 13:53:47 +0200
committerJulius Haertl <jus@bitgrid.net>2016-07-27 19:45:57 +0200
commit0acfbd5b47487871eb50a91da0765aae5b6a9636 (patch)
treea5f3db58bc49d536db0f8ec6c406301a27f60500 /apps/theming/js
parent9ebe0c8d640a555c5d82da3832ea8da0dd22ea67 (diff)
downloadnextcloud-server-0acfbd5b47487871eb50a91da0765aae5b6a9636.tar.gz
nextcloud-server-0acfbd5b47487871eb50a91da0765aae5b6a9636.zip
Theming: Preview for colorized checkboxes
Diffstat (limited to 'apps/theming/js')
-rw-r--r--apps/theming/js/settings-admin.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/apps/theming/js/settings-admin.js b/apps/theming/js/settings-admin.js
index 941ec5c711b..bf3571e2438 100644
--- a/apps/theming/js/settings-admin.js
+++ b/apps/theming/js/settings-admin.js
@@ -51,24 +51,35 @@ function preview(setting, value) {
var headerClass = document.getElementById('header');
var expandDisplayNameClass = document.getElementById('expandDisplayName');
var headerAppName = headerClass.getElementsByClassName('header-appname')[0];
- var textColor, icon;
+ var textColor, elementColor, icon;
- if (calculateLuminance(value) > 0.5) {
+ var luminance = calculateLuminance(value);
+ var elementColor = value;
+
+ if (luminance > 0.5) {
textColor = "#000000";
icon = 'caret-dark';
} else {
textColor = "#ffffff";
icon = 'caret';
}
+ if (luminance>0.8) {
+ elementColor = '#969696';
+ }
headerClass.style.background = value;
headerClass.style.backgroundImage = '../img/logo-icon.svg';
expandDisplayNameClass.style.color = textColor;
headerAppName.style.color = textColor;
- $(headerClass).find('.icon-caret').each(function() {
- $(this).css('background-image', "url('" + OC.getRootPath() + '/core/img/actions/' + icon + ".svg')");
- });
+ $('#previewStyles').html(
+ '#header .icon-caret { background-image: url(\'' + OC.getRootPath() + '/core/img/actions/' + icon + '.svg\') }' +
+ 'input[type="checkbox"].checkbox:checked + label:before {' +
+ 'background-image: url(\'' + OC.getRootPath() + '/core/img/actions/checkmark-white.svg\');' +
+ 'background-color: ' + elementColor + ';' +
+ 'background-position: center center; background-size:contain;' +
+ 'width:12px; height:12px; padding:0; margin:1px 6px 7px 2px; }'
+ );
}
if (setting === 'logoMime') {
console.log(setting);
@@ -87,6 +98,8 @@ function preview(setting, value) {
$(document).ready(function () {
$('#theming [data-toggle="tooltip"]').tooltip();
+ $('html > head').append($('<style type="text/css" id="previewStyles"></style>'));
+
var uploadParamsLogo = {
pasteZone: null,
dropZone: null,