commit: b348d22a2b429e5d1b3252933c0d970a281699b1
parent 3f331b53db3627a7e3aefddd97127b760ea4ab3a
Author: Henry Jameson <me@hjkos.com>
Date: Wed, 4 Dec 2024 15:54:20 +0200
saving "first style palette" stuff
Diffstat:
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js
@@ -141,11 +141,12 @@ const AppearanceTab = {
cOrange = '#E3FF00'
] = v
palette = { key, name, bg, fg, text, link, cRed, cBlue, cGreen, cOrange }
- this.bundledPalettes.push()
} else {
palette = { key, ...v }
}
- this.bundledPalettes.push(palette)
+ if (!palette.key.startsWith('style.')) {
+ this.bundledPalettes.push(palette)
+ }
}))
})
@@ -214,6 +215,7 @@ const AppearanceTab = {
const result = {
name: `${meta.directives.name || this.$t('settings.style.themes3.palette.imported')}: ${variant}`,
+ key: `style.${variant.toLowerCase().replace(/ /g, '_')}`,
bg,
fg,
text,
diff --git a/src/components/settings_modal/tabs/appearance_tab.vue b/src/components/settings_modal/tabs/appearance_tab.vue
@@ -114,8 +114,8 @@
v-for="p in stylePalettes || []"
:key="p.name"
class="btn button-default palette-entry"
- :class="{ toggled: isPaletteActive('style.' + p.key) }"
- @click="() => setPaletteCustom(p)"
+ :class="{ toggled: isPaletteActive(p.key) }"
+ @click="() => setPalette(p.key, p)"
>
<div class="palette-label">
<label>
diff --git a/src/modules/interface.js b/src/modules/interface.js
@@ -482,7 +482,7 @@ const interfaceMod = {
return { name: x.variant, ...cleanDirectives }
})
.forEach(palette => {
- const key = 'style.' + palette.name.toLowerCase().replace(/ /, '_')
+ const key = 'style.' + palette.name.toLowerCase().replace(/ /g, '_')
if (!firstStylePaletteName) firstStylePaletteName = key
palettesIndex[key] = () => Promise.resolve(palette)
})
@@ -494,6 +494,10 @@ const interfaceMod = {
state.useStylePalette ? firstStylePaletteName : (userPaletteName || instancePaletteName)
)
+ if (state.useStylePalette) {
+ commit('setOption', { name: 'palette', value: firstStylePaletteName })
+ }
+
state.paletteNameUsed = palette.nameUsed
state.paletteDataUsed = palette.dataUsed