Users custom colors are applied on load

This commit is contained in:
Alicia Sykes
2021-07-18 16:37:55 +01:00
parent 04b98ae66c
commit 4c44ddef26
4 changed files with 42 additions and 22 deletions

View File

@@ -24,7 +24,11 @@
<script>
import CustomThemeMaker from '@/components/Settings/CustomThemeMaker';
import { LoadExternalTheme, ApplyLocalTheme, ApplyCustomTheme } from '@/utils/ThemeHelper';
import {
LoadExternalTheme,
ApplyLocalTheme,
ApplyCustomVariables,
} from '@/utils/ThemeHelper';
import Defaults, { localStorageKeys } from '@/utils/defaults';
import IconPalette from '@/assets/interface-icons/config-color-palette.svg';
@@ -52,7 +56,7 @@ export default {
themeHelper: new LoadExternalTheme(),
themeConfiguratorOpen: false, // Control the opening of theme config popup
ApplyLocalTheme,
ApplyCustomTheme,
ApplyCustomVariables,
};
},
computed: {
@@ -100,9 +104,7 @@ export default {
/* Updates theme. Checks if the new theme is local or external,
and calls appropirate updating function. Updates local storage */
updateTheme(newTheme) {
if (newTheme === 'custom') {
this.ApplyCustomTheme();
} else if (newTheme === 'Deafault') {
if (newTheme === 'Deafault') {
this.resetToDefault();
this.themeHelper.theme = 'Deafault';
} else if (this.isThemeLocal(newTheme)) {
@@ -110,6 +112,7 @@ export default {
} else {
this.themeHelper.theme = newTheme;
}
this.ApplyCustomVariables(newTheme);
localStorage.setItem(localStorageKeys.THEME, newTheme);
},
/* Removes any applied themes */