Merge pull request #1552 from nsdoukos/night-mode-fix

Fix night mode when changing theme
This commit is contained in:
Bill Zimmerman 2024-03-22 07:52:39 +01:00 committed by GitHub
commit ee915f95a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -753,8 +753,21 @@ $(document).on("click", ".js-toggle-password", function(e) {
$(function() {
$('#theme-select').change(function() {
var theme = themes[$( "#theme-select" ).val() ];
set_theme(theme);
var theme = themes[$( "#theme-select" ).val() ];
var hasDarkTheme = theme === 'custom.php' ||
theme === 'material-light.php';
var nightModeChecked = $("#night-mode").prop("checked");
if (nightModeChecked && hasDarkTheme) {
if (theme === "custom.php") {
set_theme("lightsout.php");
} else if (theme === "material-light.php") {
set_theme("material-dark.php");
}
} else {
set_theme(theme);
}
});
});