fix palette editor in appearace tab + make it expert

This commit is contained in:
Henry Jameson 2024-12-01 21:33:24 +02:00
parent 406b973654
commit 0e1c1b04a0
2 changed files with 12 additions and 10 deletions

View file

@ -119,6 +119,8 @@ const AppearanceTab = {
})) }))
}) })
this.userPalette = this.$store.state.interface.paletteDataUsed || {}
updateIndex('palette').then(bundledPalettes => { updateIndex('palette').then(bundledPalettes => {
bundledPalettes.forEach(([key, palettePromise]) => palettePromise.then(v => { bundledPalettes.forEach(([key, palettePromise]) => palettePromise.then(v => {
let palette let palette
@ -140,10 +142,6 @@ const AppearanceTab = {
palette = { key, ...v } palette = { key, ...v }
} }
this.bundledPalettes.push(palette) this.bundledPalettes.push(palette)
if (this.isPaletteActive(key)) {
this.userPalette = palette
}
})) }))
}) })
@ -169,7 +167,15 @@ const AppearanceTab = {
}) })
}) })
}, },
watch: {
paletteDataUsed () {
this.userPalette = this.paletteDataUsed || {}
}
},
computed: { computed: {
paletteDataUsed () {
return this.$store.state.interface.paletteDataUsed
},
availableStyles () { availableStyles () {
return [ return [
...this.availableThemesV3, ...this.availableThemesV3,
@ -184,11 +190,6 @@ const AppearanceTab = {
}, },
stylePalettes () { stylePalettes () {
const ruleset = this.$store.state.interface.styleDataUsed || [] const ruleset = this.$store.state.interface.styleDataUsed || []
console.log(
'ASR',
this.$store.state.interface.paletteDataUsed,
this.$store.state.interface.styleDataUsed
)
if (!ruleset && ruleset.length === 0) return if (!ruleset && ruleset.length === 0) return
const meta = ruleset.find(x => x.component === '@meta') const meta = ruleset.find(x => x.component === '@meta')
const result = ruleset.filter(x => x.component.startsWith('@palette')) const result = ruleset.filter(x => x.component.startsWith('@palette'))

View file

@ -123,10 +123,11 @@
:style="{ backgroundColor: p[c], border: '1px solid ' + (p[c] ?? 'var(--text)') }" :style="{ backgroundColor: p[c], border: '1px solid ' + (p[c] ?? 'var(--text)') }"
/> />
</button> </button>
<h4> <h4 v-if="expertLevel > 0">
{{ $t('settings.style.themes3.palette.user') }} {{ $t('settings.style.themes3.palette.user') }}
</h4> </h4>
<PaletteEditor <PaletteEditor
v-if="expertLevel > 0"
class="userPalette" class="userPalette"
v-model="userPalette" v-model="userPalette"
:compact="true" :compact="true"