mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-09 19:56:19 +00:00
Update themeSwitch.html
This commit is contained in:
parent
8b02617fe9
commit
f1369a4d4d
1 changed files with 2 additions and 3 deletions
|
@ -11,10 +11,10 @@
|
||||||
function createThemeSwitcher() {
|
function createThemeSwitcher() {
|
||||||
const isDarkTheme = localStorage.getItem('dark-mode') === 'true';
|
const isDarkTheme = localStorage.getItem('dark-mode') === 'true';
|
||||||
const isUltra = localStorage.getItem('isUltraDarkThemeEnabled') === 'true';
|
const isUltra = localStorage.getItem('isUltraDarkThemeEnabled') === 'true';
|
||||||
const theme = isDarkTheme ? 'dark' : 'light';
|
|
||||||
if (isUltra) {
|
if (isUltra) {
|
||||||
document.documentElement.setAttribute('data-theme', 'ultra-dark');
|
document.documentElement.setAttribute('data-theme', 'ultra-dark');
|
||||||
}
|
}
|
||||||
|
const theme = isDarkTheme ? 'dark' : 'light';
|
||||||
document.querySelector('body').setAttribute('class', theme);
|
document.querySelector('body').setAttribute('class', theme);
|
||||||
return {
|
return {
|
||||||
isDarkTheme,
|
isDarkTheme,
|
||||||
|
@ -32,11 +32,10 @@
|
||||||
this.isUltra = !this.isUltra;
|
this.isUltra = !this.isUltra;
|
||||||
if (this.isUltra) {
|
if (this.isUltra) {
|
||||||
document.documentElement.setAttribute('data-theme', 'ultra-dark');
|
document.documentElement.setAttribute('data-theme', 'ultra-dark');
|
||||||
localStorage.setItem('isUltraDarkThemeEnabled', 'true');
|
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.removeAttribute('data-theme');
|
document.documentElement.removeAttribute('data-theme');
|
||||||
localStorage.setItem('isUltraDarkThemeEnabled', 'false');
|
|
||||||
}
|
}
|
||||||
|
localStorage.setItem('isUltraDarkThemeEnabled', this.isUltra.toString());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue