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
This commit is contained in:
FluxCapacitor 2020-10-19 02:03:32 -04:00 committed by GitHub
parent 8565578a88
commit d0491a0dec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;