Default to dark theme

This commit is contained in:
Matthias 2020-12-29 10:52:14 +01:00
parent d393cd948f
commit 65117a7f5f
3 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" data-theme="light"> <html lang="en" data-theme="dark">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">

View File

@ -62,7 +62,7 @@ export default Vue.extend({
this.setTheme(e.target.name.trim()); this.setTheme(e.target.name.trim());
}, },
toggleNight() { toggleNight() {
this.setTheme(this.activeTheme === 'bootstrap_dark' ? 'bootstrap' : 'bootstrap_dark'); this.setTheme(this.activeTheme === 'bootstrap' ? 'bootstrap_dark' : 'bootstrap');
}, },
setTheme(themeName) { setTheme(themeName) {
// If theme is already active, do nothing. // If theme is already active, do nothing.
@ -74,7 +74,7 @@ export default Vue.extend({
const bw = Array.from(styles).filter((w) => w.textContent?.includes('bootswatch')); const bw = Array.from(styles).filter((w) => w.textContent?.includes('bootswatch'));
document.documentElement.setAttribute( document.documentElement.setAttribute(
'data-theme', 'data-theme',
themeName.toLowerCase() === 'bootstrap_dark' ? 'dark' : 'light', themeName.toLowerCase() === 'bootstrap' ? 'light' : 'dark',
); );
// Reset all bootswatch styles // Reset all bootswatch styles
bw.forEach((style, index) => { bw.forEach((style, index) => {

View File

@ -26,7 +26,7 @@ export default new Vuex.Store({
if (theme) { if (theme) {
return theme.dark; return theme.dark;
} }
return false; return true;
}, },
getChartTheme(state, getters) { getChartTheme(state, getters) {
return getters.isDarkTheme ? 'dark' : 'light'; return getters.isDarkTheme ? 'dark' : 'light';