mirror of
https://github.com/w0rng/amnezia-wg-easy.git
synced 2025-04-27 05:40:05 +03:00
Add Darkmode
This commit is contained in:
parent
e967522f88
commit
042168f0bb
12 changed files with 2566 additions and 206 deletions
|
@ -45,6 +45,8 @@ new Vue({
|
|||
currentRelease: null,
|
||||
latestRelease: null,
|
||||
|
||||
isDark: null,
|
||||
|
||||
chartOptions: {
|
||||
chart: {
|
||||
background: 'transparent',
|
||||
|
@ -239,6 +241,16 @@ new Vue({
|
|||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
toggleTheme() {
|
||||
if (this.isDark) {
|
||||
localStorage.theme = 'light';
|
||||
document.documentElement.classList.remove('dark');
|
||||
} else {
|
||||
localStorage.theme = 'dark';
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
this.isDark = !this.isDark;
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
bytes,
|
||||
|
@ -247,6 +259,11 @@ new Vue({
|
|||
},
|
||||
},
|
||||
mounted() {
|
||||
this.isDark = false;
|
||||
if (localStorage.theme === 'dark') {
|
||||
this.isDark = true;
|
||||
}
|
||||
|
||||
this.api = new API();
|
||||
this.api.getSession()
|
||||
.then((session) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue