generateModifyVars.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { generateAntColors, primaryColor } from '../config/themeConfig';
  2. import { getThemeVariables } from 'ant-design-vue/dist/theme';
  3. import { resolve } from 'path';
  4. /**
  5. * less global variable
  6. */
  7. export function generateModifyVars(dark = false) {
  8. const palettes = generateAntColors(primaryColor);
  9. const primary = palettes[5];
  10. const primaryColorObj: Record<string, string> = {};
  11. for (let index = 0; index < 10; index++) {
  12. primaryColorObj[`primary-${index + 1}`] = palettes[index];
  13. }
  14. const modifyVars = getThemeVariables({ dark });
  15. return {
  16. ...modifyVars,
  17. // Used for global import to avoid the need to import each style file separately
  18. // reference: Avoid repeated references
  19. hack: `${modifyVars.hack} @import (reference) "${resolve('src/design/config.less')}";`,
  20. '@ant-prefix': 'zxm',
  21. 'ant-prefix': 'zxm',
  22. 'primary-color': primary,
  23. ...primaryColorObj,
  24. 'info-color': primary,
  25. 'processing-color': primary,
  26. 'success-color': '#55D187', // Success color
  27. 'error-color': '#ED6F6F', // False color
  28. 'warning-color': '#EFBD47', // Warning color
  29. //'border-color-base': '#EEEEEE',
  30. 'font-size-base': '14px', // Main font size
  31. 'border-radius-base': '2px', // Component/float fillet
  32. 'link-color': primary, // Link color
  33. 'app-content-background': '#fafafa', // Link color
  34. };
  35. }