Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(theme): fix color change on theme change #1933

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/components/settings/SettingsUiSettingsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<settings-row
:title="$t('Settings.UiSettingsTab.Theme')"
:sub-title="$t('Settings.UiSettingsTab.ThemeDescription')">
<v-select v-model="theme" :items="themes" class="mt-0" hide-details outlined dense />
<v-select v-model="themeName" :items="themes" class="mt-0" hide-details outlined dense />
</settings-row>
<v-divider class="my-2" />
<settings-row :title="$t('Settings.UiSettingsTab.Logo')">
Expand Down Expand Up @@ -298,7 +298,6 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin, ThemeMixin)
mdiRestart = mdiRestart
mdiTimerOutline = mdiTimerOutline

defaultPrimaryColor = defaultPrimaryColor
defaultBigThumbnailBackground = defaultBigThumbnailBackground

get mode() {
Expand All @@ -309,11 +308,19 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin, ThemeMixin)
this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.mode', value: newVal })
}

get theme() {
get themeName() {
return this.$store.getters['gui/theme']
}

set theme(newVal: string) {
set themeName(newVal: string) {
const newTheme = themes.find((theme) => theme.name === newVal)
if (this.logoColor === this.defaultLogoColor) {
this.logoColor = newTheme?.colorLogo ?? defaultLogoColor
}
if (this.primaryColor === this.defaultPrimaryColor) {
this.primaryColor = newTheme?.colorPrimary ?? defaultPrimaryColor
}

this.$store.dispatch('gui/saveSetting', { name: 'uiSettings.theme', value: newVal })
}

Expand Down Expand Up @@ -348,7 +355,11 @@ export default class SettingsUiSettingsTab extends Mixins(BaseMixin, ThemeMixin)
}

get defaultLogoColor() {
return themes.find((theme) => theme.name === this.themeName)?.colorLogo ?? defaultLogoColor
return this.theme?.colorLogo ?? defaultLogoColor
}

get defaultPrimaryColor() {
return this.theme?.colorPrimary ?? defaultPrimaryColor
}

get primaryColor() {
Expand Down
Loading