diff --git a/src/www/js/app.js b/src/www/js/app.js index e22cbfe0..f94e5006 100644 --- a/src/www/js/app.js +++ b/src/www/js/app.js @@ -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 => {