Fix "switchery" dark theme by using css-variables. (#1726)

Fix "switchery" dark theme by using css-variables.
10.7.0-preview
Michael Keller 2019-10-15 08:40:41 +13:00 committed by GitHub
commit c6fd43fdec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 46 deletions

View File

@ -11,6 +11,7 @@
--paper: url(../../images/paper-dark.jpg);
--ledAccent: #6e6e6e;
--ledBackground: #424242;
--switcherysecond: #858585;
}
body {

View File

@ -13,6 +13,7 @@
--paper: url(../../images/paper.jpg);
--ledAccent: #adadad;
--ledBackground: #e9e9e9;
--switcherysecond: #c4c4c4;
}
* {

View File

@ -44,13 +44,7 @@ var GUI_control = function () {
'servos',
'vtx',
];
this.defaultAllowedOSDTabsWhenConnected = [
'setup_osd',
'osd',
'power',
'sensors',
'transponder',
];
this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;
// check which operating system is user running
@ -79,7 +73,7 @@ const GUI_Modes = {
NWJS: "NW.js",
ChromeApp: "Chrome",
Other: "Other"
}
};
// Timer managing methods
@ -221,7 +215,7 @@ GUI_control.prototype.timeout_remove = function (name) {
return false;
};
// no input paremeters
// no input parameters
// return = returns timers killed in last call
GUI_control.prototype.timeout_kill_all = function () {
var timers_killed = 0;
@ -274,58 +268,35 @@ GUI_control.prototype.tab_switch_cleanup = function (callback) {
GUI_control.prototype.switchery = function() {
$('.togglesmall').each(function(index, elem) {
if(DarkTheme.configEnabled) {
var switchery = new Switchery(elem, {
size: 'small',
color: '#ffbb00',
secondaryColor: '#858585'
color: 'var(--accent)',
secondaryColor: 'var(--switcherysecond)'
});
} else {
var switchery = new Switchery(elem, {
size: 'small',
color: '#ffbb00',
secondaryColor: '#c4c4c4'
});
}
$(elem).on("change", function (evt) {
$(elem).on("change", function () {
switchery.setPosition();
});
$(elem).removeClass('togglesmall');
});
$('.toggle').each(function(index, elem) {
if(DarkTheme.configEnabled) {
var switchery = new Switchery(elem, {
color: '#ffbb00',
secondaryColor: '#858585'
color: 'var(--accent)',
secondaryColor: 'var(--switcherysecond)'
});
} else {
var switchery = new Switchery(elem, {
color: '#ffbb00',
secondaryColor: '#c4c4c4'
});
}
$(elem).on("change", function (evt) {
$(elem).on("change", function () {
switchery.setPosition();
});
$(elem).removeClass('toggle');
});
$('.togglemedium').each(function(index, elem) {
if(DarkTheme.configEnabled) {
var switchery = new Switchery(elem, {
className: 'switcherymid',
color: '#ffbb00',
secondaryColor: '#858585'
color: 'var(--accent)',
secondaryColor: 'var(--switcherysecond)'
});
} else {
var switchery = new Switchery(elem, {
className: 'switcherymid',
color: '#ffbb00',
secondaryColor: '#c4c4c4'
});
}
$(elem).on("change", function (evt) {
$(elem).on("change", function () {
switchery.setPosition();
});
$(elem).removeClass('togglemedium');
@ -344,7 +315,7 @@ GUI_control.prototype.content_ready = function (callback) {
}
// loading tooltip
jQuery(document).ready(function($) {
jQuery(document).ready(function() {
new jBox('Tooltip', {
attach: '.cf_tip',
@ -377,7 +348,7 @@ GUI_control.prototype.content_ready = function (callback) {
});
if (callback) callback();
}
};
GUI_control.prototype.selectDefaultTabWhenConnected = function() {
ConfigStorage.get(['rememberLastTab', 'lastTab'], function (result) {
@ -393,13 +364,13 @@ GUI_control.prototype.selectDefaultTabWhenConnected = function() {
GUI_control.prototype.isChromeApp = function () {
return this.Mode == GUI_Modes.ChromeApp;
}
};
GUI_control.prototype.isNWJS = function () {
return this.Mode == GUI_Modes.NWJS;
}
};
GUI_control.prototype.isOther = function () {
return this.Mode == GUI_Modes.Other;
}
};
// initialize object into GUI variable