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,
downloadTheme: this.downloadTheme,
applyTheme: this.applyTheme,
applyFont: this.applyFont
applyFont: this.applyFont,
replaceColorPalette: this.replaceColorPalette
}
};
},
@ -171,6 +172,11 @@ export default {
} catch (error) {
// 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: {

View File

@ -82,11 +82,6 @@ export default {
};
},
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() {
const newPreset = presets[this.basePreset];
@ -187,7 +182,7 @@ export default {
fontFamily: 'Inter var'
}
};
this.replaceColorPalette();
this.designerService.replaceColorPalette();
usePreset(preset);
this.designerService.refreshACTokens();

View File

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

View File

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