mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-17 21:35:33 +03:00
Fixed auto dark theme on android
This commit is contained in:
parent
a1f8315795
commit
b87435855e
4 changed files with 53 additions and 14 deletions
|
@ -514,9 +514,22 @@ function startProcess() {
|
|||
setDarkTheme(result.darkTheme);
|
||||
}
|
||||
});
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", function() {
|
||||
DarkTheme.autoSet();
|
||||
});
|
||||
if (GUI.isCordova()) {
|
||||
let darkMode = false;
|
||||
const checkDarkMode = function() {
|
||||
cordova.plugins.ThemeDetection.isDarkModeEnabled(function(success) {
|
||||
if (success.value !== darkMode) {
|
||||
darkMode = success.value;
|
||||
DarkTheme.autoSet();
|
||||
}
|
||||
});
|
||||
};
|
||||
setInterval(checkDarkMode, 500);
|
||||
} else {
|
||||
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", function() {
|
||||
DarkTheme.autoSet();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setDarkTheme(enabled) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue