uno.config.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
  2. import presetRemToPx from '@unocss/preset-rem-to-px'
  3. import { defineConfig, presetAttributify, presetIcons, presetWind3 } from 'unocss'
  4. import { getIcons } from './build/index.js'
  5. // 统一的响应式字体插件,集成了静态和动态规则
  6. import { responsiveFontUnifiedPreset } from './src/plugins/responsive-font-unified.js'
  7. const icons = getIcons()
  8. export default defineConfig({
  9. presets: [
  10. responsiveFontUnifiedPreset(),
  11. presetWind3(),
  12. presetAttributify(),
  13. presetIcons({
  14. warn: false,
  15. prefix: ['ai-', 'i-', 'mdi-', 'fa-'],
  16. extraProperties: {
  17. display: 'inline-block',
  18. width: '1em',
  19. height: '1em',
  20. },
  21. collections: {
  22. 'ai-icon': FileSystemIconLoader('./src/assets/icons/ai-icon'),
  23. 'icon': FileSystemIconLoader('./src/assets/icons/ai-icon'),
  24. },
  25. }),
  26. presetRemToPx({ baseFontSize: 4 }),
  27. ],
  28. safelist: icons.map(icon => `${icon} ${icon}?mask`.split(' ')).flat(),
  29. shortcuts: [
  30. ['wh-full', 'w-full h-full'],
  31. ['f-c-c', 'flex justify-center items-center'],
  32. ['flex-col', 'flex flex-col'],
  33. ['card-border', 'border border-solid border-light_border dark:border-dark_border'],
  34. ['auto-bg', 'bg-white dark:bg-dark'],
  35. ['auto-bg-hover', 'hover:bg-#eaf0f1 hover:dark:bg-#1b2429'],
  36. ['auto-bg-highlight', 'bg-#eaf0f1 dark:bg-#1b2429'],
  37. ['text-highlight', 'rounded-4 px-8 py-2 auto-bg-highlight'],
  38. ],
  39. rules: [
  40. [
  41. 'card-shadow',
  42. { 'box-shadow': '0 1px 2px -2px #00000029, 0 3px 6px #0000001f, 0 5px 12px 4px #00000017' },
  43. ],
  44. ],
  45. theme: {
  46. colors: {
  47. primary: 'var(--primary-color)',
  48. dark: '#18181c',
  49. light_border: '#efeff5',
  50. dark_border: '#2d2d30',
  51. // 语义化颜色
  52. info: '#909399',
  53. success: '#67C23A',
  54. warning: '#E6A23C',
  55. error: '#F56C6C',
  56. },
  57. },
  58. })