mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-16 21:05:30 +03:00
Fix "switchery" dark theme by using css-variables. (#1726)
Fix "switchery" dark theme by using css-variables.
This commit is contained in:
commit
c6fd43fdec
3 changed files with 19 additions and 46 deletions
|
@ -11,6 +11,7 @@
|
||||||
--paper: url(../../images/paper-dark.jpg);
|
--paper: url(../../images/paper-dark.jpg);
|
||||||
--ledAccent: #6e6e6e;
|
--ledAccent: #6e6e6e;
|
||||||
--ledBackground: #424242;
|
--ledBackground: #424242;
|
||||||
|
--switcherysecond: #858585;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
--paper: url(../../images/paper.jpg);
|
--paper: url(../../images/paper.jpg);
|
||||||
--ledAccent: #adadad;
|
--ledAccent: #adadad;
|
||||||
--ledBackground: #e9e9e9;
|
--ledBackground: #e9e9e9;
|
||||||
|
--switcherysecond: #c4c4c4;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
|
|
@ -44,13 +44,7 @@ var GUI_control = function () {
|
||||||
'servos',
|
'servos',
|
||||||
'vtx',
|
'vtx',
|
||||||
];
|
];
|
||||||
this.defaultAllowedOSDTabsWhenConnected = [
|
|
||||||
'setup_osd',
|
|
||||||
'osd',
|
|
||||||
'power',
|
|
||||||
'sensors',
|
|
||||||
'transponder',
|
|
||||||
];
|
|
||||||
this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;
|
this.allowedTabs = this.defaultAllowedTabsWhenDisconnected;
|
||||||
|
|
||||||
// check which operating system is user running
|
// check which operating system is user running
|
||||||
|
@ -79,7 +73,7 @@ const GUI_Modes = {
|
||||||
NWJS: "NW.js",
|
NWJS: "NW.js",
|
||||||
ChromeApp: "Chrome",
|
ChromeApp: "Chrome",
|
||||||
Other: "Other"
|
Other: "Other"
|
||||||
}
|
};
|
||||||
|
|
||||||
// Timer managing methods
|
// Timer managing methods
|
||||||
|
|
||||||
|
@ -221,7 +215,7 @@ GUI_control.prototype.timeout_remove = function (name) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// no input paremeters
|
// no input parameters
|
||||||
// return = returns timers killed in last call
|
// return = returns timers killed in last call
|
||||||
GUI_control.prototype.timeout_kill_all = function () {
|
GUI_control.prototype.timeout_kill_all = function () {
|
||||||
var timers_killed = 0;
|
var timers_killed = 0;
|
||||||
|
@ -274,58 +268,35 @@ GUI_control.prototype.tab_switch_cleanup = function (callback) {
|
||||||
|
|
||||||
GUI_control.prototype.switchery = function() {
|
GUI_control.prototype.switchery = function() {
|
||||||
$('.togglesmall').each(function(index, elem) {
|
$('.togglesmall').each(function(index, elem) {
|
||||||
if(DarkTheme.configEnabled) {
|
|
||||||
var switchery = new Switchery(elem, {
|
var switchery = new Switchery(elem, {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
color: '#ffbb00',
|
color: 'var(--accent)',
|
||||||
secondaryColor: '#858585'
|
secondaryColor: 'var(--switcherysecond)'
|
||||||
});
|
});
|
||||||
} else {
|
$(elem).on("change", function () {
|
||||||
var switchery = new Switchery(elem, {
|
|
||||||
size: 'small',
|
|
||||||
color: '#ffbb00',
|
|
||||||
secondaryColor: '#c4c4c4'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$(elem).on("change", function (evt) {
|
|
||||||
switchery.setPosition();
|
switchery.setPosition();
|
||||||
});
|
});
|
||||||
$(elem).removeClass('togglesmall');
|
$(elem).removeClass('togglesmall');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggle').each(function(index, elem) {
|
$('.toggle').each(function(index, elem) {
|
||||||
if(DarkTheme.configEnabled) {
|
|
||||||
var switchery = new Switchery(elem, {
|
var switchery = new Switchery(elem, {
|
||||||
color: '#ffbb00',
|
color: 'var(--accent)',
|
||||||
secondaryColor: '#858585'
|
secondaryColor: 'var(--switcherysecond)'
|
||||||
});
|
});
|
||||||
} else {
|
$(elem).on("change", function () {
|
||||||
var switchery = new Switchery(elem, {
|
|
||||||
color: '#ffbb00',
|
|
||||||
secondaryColor: '#c4c4c4'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$(elem).on("change", function (evt) {
|
|
||||||
switchery.setPosition();
|
switchery.setPosition();
|
||||||
});
|
});
|
||||||
$(elem).removeClass('toggle');
|
$(elem).removeClass('toggle');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.togglemedium').each(function(index, elem) {
|
$('.togglemedium').each(function(index, elem) {
|
||||||
if(DarkTheme.configEnabled) {
|
|
||||||
var switchery = new Switchery(elem, {
|
var switchery = new Switchery(elem, {
|
||||||
className: 'switcherymid',
|
className: 'switcherymid',
|
||||||
color: '#ffbb00',
|
color: 'var(--accent)',
|
||||||
secondaryColor: '#858585'
|
secondaryColor: 'var(--switcherysecond)'
|
||||||
});
|
});
|
||||||
} else {
|
$(elem).on("change", function () {
|
||||||
var switchery = new Switchery(elem, {
|
|
||||||
className: 'switcherymid',
|
|
||||||
color: '#ffbb00',
|
|
||||||
secondaryColor: '#c4c4c4'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$(elem).on("change", function (evt) {
|
|
||||||
switchery.setPosition();
|
switchery.setPosition();
|
||||||
});
|
});
|
||||||
$(elem).removeClass('togglemedium');
|
$(elem).removeClass('togglemedium');
|
||||||
|
@ -344,7 +315,7 @@ GUI_control.prototype.content_ready = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// loading tooltip
|
// loading tooltip
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function() {
|
||||||
|
|
||||||
new jBox('Tooltip', {
|
new jBox('Tooltip', {
|
||||||
attach: '.cf_tip',
|
attach: '.cf_tip',
|
||||||
|
@ -377,7 +348,7 @@ GUI_control.prototype.content_ready = function (callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
}
|
};
|
||||||
|
|
||||||
GUI_control.prototype.selectDefaultTabWhenConnected = function() {
|
GUI_control.prototype.selectDefaultTabWhenConnected = function() {
|
||||||
ConfigStorage.get(['rememberLastTab', 'lastTab'], function (result) {
|
ConfigStorage.get(['rememberLastTab', 'lastTab'], function (result) {
|
||||||
|
@ -393,13 +364,13 @@ GUI_control.prototype.selectDefaultTabWhenConnected = function() {
|
||||||
|
|
||||||
GUI_control.prototype.isChromeApp = function () {
|
GUI_control.prototype.isChromeApp = function () {
|
||||||
return this.Mode == GUI_Modes.ChromeApp;
|
return this.Mode == GUI_Modes.ChromeApp;
|
||||||
}
|
};
|
||||||
GUI_control.prototype.isNWJS = function () {
|
GUI_control.prototype.isNWJS = function () {
|
||||||
return this.Mode == GUI_Modes.NWJS;
|
return this.Mode == GUI_Modes.NWJS;
|
||||||
}
|
};
|
||||||
GUI_control.prototype.isOther = function () {
|
GUI_control.prototype.isOther = function () {
|
||||||
return this.Mode == GUI_Modes.Other;
|
return this.Mode == GUI_Modes.Other;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// initialize object into GUI variable
|
// initialize object into GUI variable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue