Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTara Rostami <132676256+TaraRostami@users.noreply.github.com>2024-02-28 14:05:01 +0300
committerGitHub <noreply@github.com>2024-02-28 14:05:01 +0300
commit836ee29b786fd3ab3958f0984e5b02e6a89976cf (patch)
tree1836b33075cfb63ec29b0c6568e95dfb9149e204 /web/html/xui/component
parent806b57f9597d57c786c26472aa948fdee81ea7fa (diff)
Optimize Dark Theme & Ultra Dark (#1889)
--------- Co-authored-by: MHSanaei <ho3ein.sanaei@gmail.com> Co-authored-by: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/html/xui/component')
-rw-r--r--web/html/xui/component/themeSwitch.html30
1 files changed, 23 insertions, 7 deletions
diff --git a/web/html/xui/component/themeSwitch.html b/web/html/xui/component/themeSwitch.html
index 9ca080d9..2301da94 100644
--- a/web/html/xui/component/themeSwitch.html
+++ b/web/html/xui/component/themeSwitch.html
@@ -10,32 +10,48 @@
<script>
function createThemeSwitcher() {
const isDarkTheme = localStorage.getItem('dark-mode') === 'true';
+ const isUltra = localStorage.getItem('isUltraDarkThemeEnabled') === 'true';
+ if (isUltra) {
+ 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 {
isDarkTheme,
+ isUltra,
get currentTheme() {
return this.isDarkTheme ? 'dark' : 'light';
},
toggleTheme() {
this.isDarkTheme = !this.isDarkTheme;
localStorage.setItem('dark-mode', this.isDarkTheme);
- document.querySelector('body').setAttribute('class', this.isDarkTheme ? 'dark' : 'light')
+ document.querySelector('body').setAttribute('class', this.isDarkTheme ? 'dark' : 'light');
document.getElementById('message').className = themeSwitcher.currentTheme;
},
+ toggleUltra() {
+ this.isUltra = !this.isUltra;
+ if (this.isUltra) {
+ document.documentElement.setAttribute('data-theme', 'ultra-dark');
+ } else {
+ document.documentElement.removeAttribute('data-theme');
+ }
+ localStorage.setItem('isUltraDarkThemeEnabled', this.isUltra.toString());
+ }
};
}
-
const themeSwitcher = createThemeSwitcher();
-
Vue.component('theme-switch', {
props: [],
template: `{{template "component/themeSwitchTemplate"}}`,
- data: () => ({ themeSwitcher }),
+ data: () => ({
+ themeSwitcher
+ }),
mounted() {
- this.$message.config({getContainer: () => document.getElementById('message')});
+ this.$message.config({
+ getContainer: () => document.getElementById('message')
+ });
document.getElementById('message').className = themeSwitcher.currentTheme;
}
});
</script>
-{{end}} \ No newline at end of file
+{{end}}