Add Darkmode

This commit is contained in:
goodbyepavlyi 2023-01-21 20:30:19 +01:00 committed by Philip H.
parent e967522f88
commit 042168f0bb
12 changed files with 2566 additions and 206 deletions

View file

@ -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) => {