2021-02-09 23:47:14 +08:00
|
|
|
/**
|
|
|
|
|
* Vite plugin for website theme color switching
|
|
|
|
|
* https://github.com/anncwb/vite-plugin-theme
|
|
|
|
|
*/
|
2021-02-03 23:52:55 +08:00
|
|
|
import { viteThemePlugin, mixLighten, mixDarken, tinycolor } from 'vite-plugin-theme';
|
|
|
|
|
import { getThemeColors, generateColors } from '../../config/themeConfig';
|
|
|
|
|
|
|
|
|
|
export function configThemePlugin() {
|
|
|
|
|
const colors = generateColors({
|
|
|
|
|
mixDarken,
|
|
|
|
|
mixLighten,
|
|
|
|
|
tinycolor,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const plugin = viteThemePlugin({
|
|
|
|
|
colorVariables: [...getThemeColors(), ...colors],
|
|
|
|
|
});
|
|
|
|
|
return plugin;
|
|
|
|
|
}
|