theme.ts 506 B

12345678910111213141516171819
  1. /**
  2. * Vite plugin for website theme color switching
  3. * https://github.com/anncwb/vite-plugin-theme
  4. */
  5. import { viteThemePlugin, mixLighten, mixDarken, tinycolor } from 'vite-plugin-theme';
  6. import { getThemeColors, generateColors } from '../../config/themeConfig';
  7. export function configThemePlugin() {
  8. const colors = generateColors({
  9. mixDarken,
  10. mixLighten,
  11. tinycolor,
  12. });
  13. const plugin = viteThemePlugin({
  14. colorVariables: [...getThemeColors(), ...colors],
  15. });
  16. return plugin;
  17. }