From d0491a0dec915a29802df91baf6776bba3941c60 Mon Sep 17 00:00:00 2001 From: FluxCapacitor <31071265+FluxCapacitor2@users.noreply.github.com> Date: Mon, 19 Oct 2020 02:03:32 -0400 Subject: [PATCH] Allow setting night mode (and other themes) by default in theme.yml (#1612) - Also fixes default color not being applied from theme.yml Affects issues: - Close #1274 --- .../resources/assets/plan/web/js/color-selector.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Plan/common/src/main/resources/assets/plan/web/js/color-selector.js b/Plan/common/src/main/resources/assets/plan/web/js/color-selector.js index 2cdd50f22..355bab248 100644 --- a/Plan/common/src/main/resources/assets/plan/web/js/color-selector.js +++ b/Plan/common/src/main/resources/assets/plan/web/js/color-selector.js @@ -10,15 +10,14 @@ 'brown', 'grey', 'blue-grey']; const selectedColor = window.localStorage.getItem('themeColor'); - const themeDefaultColor = 'plan'; + const themeDefaultColor = '${defaultTheme}'; let currentColor = 'plan'; - if (selectedColor === null) { - window.localStorage.setItem('themeColor', currentColor); - } - // Function for changing color function setColor(nextColor) { + if (selectedColor === null) { + window.localStorage.setItem('themeColor', currentColor); + } $('body').removeClass('theme-' + currentColor).addClass('theme-' + nextColor); if (!nextColor || nextColor == currentColor) { return; @@ -71,7 +70,7 @@ // Change the color of the theme setColor(selectedColor ? selectedColor : themeDefaultColor); - let nightMode = window.localStorage.getItem('nightMode') == 'true'; + let nightMode = window.localStorage.getItem('nightMode') == 'true' || '${defaultTheme}' == 'night'; const saturationReduction = 0.70;