refactor(hooks): refactor @sa/color-palette

This commit is contained in:
Soybean
2024-04-16 00:57:24 +08:00
parent d9af5aa2d3
commit 93191737dd
15 changed files with 2163 additions and 2061 deletions

View File

@@ -81,14 +81,12 @@ export const useThemeStore = defineStore(SetupStoreId.Theme, () => {
*/
function updateThemeColors(key: App.Theme.ThemeColorKey, color: string) {
// get a color palette by provided color and color name, and use the suitable color
const colorPalette = getColorPalette(color, key);
const mainColor = colorPalette.main.hexcode;
const { main } = getColorPalette(color);
if (key === 'primary') {
settings.value.themeColor = mainColor;
settings.value.themeColor = main.hex;
} else {
settings.value.otherColor[key] = mainColor;
settings.value.otherColor[key] = main.hex;
}
}