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. 'primary-color': primary,
  21. ...primaryColorObj,
  22. 'info-color': primary,
  23. 'processing-color': primary,
  24. 'success-color': '#55D187', // Success color
  25. 'error-color': '#ED6F6F', // False color
  26. 'warning-color': '#EFBD47', // Warning color
  27. 'clear-color': '#ff8989', //清空以及删除 颜色
  28. //'border-color-base': '#EEEEEE',
  29. 'font-size-base': '14px', // Main font size
  30. 'border-radius-base': '2px', // Component/float fillet
  31. 'link-color': primary, // Link color
  32. 'app-content-background': '#fafafa', // Link color
  33. };
  34. }