mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
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:
parent
8565578a88
commit
d0491a0dec
@ -10,15 +10,14 @@
|
|||||||
'brown', 'grey', 'blue-grey'];
|
'brown', 'grey', 'blue-grey'];
|
||||||
|
|
||||||
const selectedColor = window.localStorage.getItem('themeColor');
|
const selectedColor = window.localStorage.getItem('themeColor');
|
||||||
const themeDefaultColor = 'plan';
|
const themeDefaultColor = '${defaultTheme}';
|
||||||
let currentColor = 'plan';
|
let currentColor = 'plan';
|
||||||
|
|
||||||
if (selectedColor === null) {
|
|
||||||
window.localStorage.setItem('themeColor', currentColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function for changing color
|
// Function for changing color
|
||||||
function setColor(nextColor) {
|
function setColor(nextColor) {
|
||||||
|
if (selectedColor === null) {
|
||||||
|
window.localStorage.setItem('themeColor', currentColor);
|
||||||
|
}
|
||||||
$('body').removeClass('theme-' + currentColor).addClass('theme-' + nextColor);
|
$('body').removeClass('theme-' + currentColor).addClass('theme-' + nextColor);
|
||||||
if (!nextColor || nextColor == currentColor) {
|
if (!nextColor || nextColor == currentColor) {
|
||||||
return;
|
return;
|
||||||
@ -71,7 +70,7 @@
|
|||||||
// Change the color of the theme
|
// Change the color of the theme
|
||||||
setColor(selectedColor ? selectedColor : themeDefaultColor);
|
setColor(selectedColor ? selectedColor : themeDefaultColor);
|
||||||
|
|
||||||
let nightMode = window.localStorage.getItem('nightMode') == 'true';
|
let nightMode = window.localStorage.getItem('nightMode') == 'true' || '${defaultTheme}' == 'night';
|
||||||
|
|
||||||
const saturationReduction = 0.70;
|
const saturationReduction = 0.70;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user