Blame view

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