Add replaceColorPalette

pull/7146/head
Cagatay Civici 2025-01-03 10:18:21 +03:00
parent e7f602f843
commit 72bf74a104
4 changed files with 12 additions and 9 deletions

View File

@ -37,7 +37,8 @@ export default {
saveTheme: this.saveTheme, saveTheme: this.saveTheme,
downloadTheme: this.downloadTheme, downloadTheme: this.downloadTheme,
applyTheme: this.applyTheme, applyTheme: this.applyTheme,
applyFont: this.applyFont applyFont: this.applyFont,
replaceColorPalette: this.replaceColorPalette
} }
}; };
}, },
@ -171,6 +172,11 @@ export default {
} catch (error) { } catch (error) {
// silent fail as some fonts may have not all the font weights // silent fail as some fonts may have not all the font weights
} }
},
replaceColorPalette() {
this.$appState.designer.theme.preset.semantic.primary = this.$appState.designer.theme.preset.primitive.emerald;
this.$appState.designer.theme.preset.semantic.colorScheme.light.surface = { ...{ 0: '#ffffff' }, ...this.$appState.designer.theme.preset.primitive.slate };
this.$appState.designer.theme.preset.semantic.colorScheme.dark.surface = { ...{ 0: '#ffffff' }, ...this.$appState.designer.theme.preset.primitive.zinc };
} }
}, },
computed: { computed: {

View File

@ -82,11 +82,6 @@ export default {
}; };
}, },
methods: { methods: {
replaceColorPalette() {
this.$appState.designer.theme.preset.semantic.primary = this.$appState.designer.theme.preset.primitive.emerald;
this.$appState.designer.theme.preset.semantic.colorScheme.light.surface = { ...{ 0: '#ffffff' }, ...this.$appState.designer.theme.preset.primitive.slate };
this.$appState.designer.theme.preset.semantic.colorScheme.dark.surface = { ...{ 0: '#ffffff' }, ...this.$appState.designer.theme.preset.primitive.zinc };
},
async createThemeFromPreset() { async createThemeFromPreset() {
const newPreset = presets[this.basePreset]; const newPreset = presets[this.basePreset];
@ -187,7 +182,7 @@ export default {
fontFamily: 'Inter var' fontFamily: 'Inter var'
} }
}; };
this.replaceColorPalette(); this.designerService.replaceColorPalette();
usePreset(preset); usePreset(preset);
this.designerService.refreshACTokens(); this.designerService.refreshACTokens();

View File

@ -195,6 +195,7 @@ export default {
usePreset(this.$appState.designer.theme.preset); usePreset(this.$appState.designer.theme.preset);
this.designerService.applyFont(this.$appState.designer.theme.config.fontFamily); this.designerService.applyFont(this.$appState.designer.theme.config.fontFamily);
document.documentElement.style.fontSize = this.$appState.designer.theme.config.fontSize; document.documentElement.style.fontSize = this.$appState.designer.theme.config.fontSize;
this.designerService.replaceColorPalette();
this.designerService.refreshACTokens(); this.designerService.refreshACTokens();
this.$appState.designer.activeView = 'editor'; this.$appState.designer.activeView = 'editor';
} }

View File

@ -77,18 +77,19 @@ export default {
'Noto Sans Display', 'Noto Sans Display',
'Nunito', 'Nunito',
'Nunito Sans', 'Nunito Sans',
'Onest',
'Open Sans', 'Open Sans',
'Outfit',
'Poppins', 'Poppins',
'PT Sans', 'PT Sans',
'Public Sans', 'Public Sans',
'Quicksand', 'Quicksand',
'Raleway', 'Raleway',
'Roboto', 'Roboto',
'Signika',
'Source Sans Pro', 'Source Sans Pro',
'Space Grotesk', 'Space Grotesk',
'Spline Sans',
'Titillium Web', 'Titillium Web',
'Ubuntu Condensed',
'Ubuntu Sans' 'Ubuntu Sans'
] ]
}; };