Vben
authored
|
1
|
import { getThemeColors, generateColors } from '../../../build/config/themeConfig';
|
vben
authored
|
2
|
|
vben
authored
|
3
4
|
import { replaceStyleVariables } from 'vite-plugin-theme/es/client';
import { mixLighten, mixDarken, tinycolor } from 'vite-plugin-theme/es/colorUtils';
|
vben
authored
|
5
|
|
Vben
authored
|
6
|
export async function changeTheme(color: string) {
|
vben
authored
|
7
8
9
10
11
|
const colors = generateColors({
mixDarken,
mixLighten,
tinycolor,
color,
|
vben
authored
|
12
13
|
});
|
vben
authored
|
14
|
return await replaceStyleVariables({
|
Vben
authored
|
15
|
colorVariables: [...getThemeColors(color), ...colors],
|
vben
authored
|
16
17
|
});
}
|