diff --git a/src/client/pages/theme-editor.vue b/src/client/pages/theme-editor.vue index 02a21d9d6..6cc6b560c 100644 --- a/src/client/pages/theme-editor.vue +++ b/src/client/pages/theme-editor.vue @@ -4,12 +4,12 @@
{{ $ts.backgroundColor }}
-
-
@@ -30,7 +30,7 @@
@@ -112,18 +112,17 @@ export default defineComponent({ created() { const currentBgColor = getComputedStyle(document.documentElement).getPropertyValue('--bg'); const matchedBgColor = this.bgColors.find(x => tinycolor(x.color).toRgbString() === tinycolor(currentBgColor).toRgbString()); - this.bgColor = matchedBgColor ? matchedBgColor : this.bgColors[0]; + if (matchedBgColor) this.bgColor = matchedBgColor; const currentAccentColor = getComputedStyle(document.documentElement).getPropertyValue('--accent'); const matchedAccentColor = this.accentColors.find(x => tinycolor(x).toRgbString() === tinycolor(currentAccentColor).toRgbString()); - this.accentColor = matchedAccentColor ? matchedAccentColor : this.accentColors[0]; + if (matchedAccentColor) this.accentColor = matchedAccentColor; const currentFgColor = getComputedStyle(document.documentElement).getPropertyValue('--fg'); const matchedFgColor = this.fgColors.find(x => [tinycolor(x.forLight).toRgbString(), tinycolor(x.forDark).toRgbString()].includes(tinycolor(currentFgColor).toRgbString())); - this.fgColor = matchedFgColor ? matchedFgColor : this.fgColors[0]; + if (matchedFgColor) this.fgColor = matchedFgColor; this.$watch('bgColor', this.apply); this.$watch('accentColor', this.apply); this.$watch('fgColor', this.apply); - this.apply(); }, methods: { @@ -141,6 +140,10 @@ export default defineComponent({ }, apply() { + if (this.bgColor == null) this.bgColor = this.bgColors[0]; + if (this.accentColor == null) this.accentColor = this.accentColors[0]; + if (this.fgColor == null) this.fgColor = this.fgColors[0]; + const theme = this.convert(); applyTheme(theme, true);