uno.config.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // 忽略ts
  2. // @ts-nocheck
  3. import { defineConfig, presetIcons, presetUno, presetAttributify } from 'unocss'
  4. import UnocssIcons from '@unocss/preset-icons'
  5. import presetRemToPx from '@unocss/preset-rem-to-px'
  6. export default defineConfig({
  7. theme: {
  8. colors: {
  9. primary: '#2AC2B5',
  10. success: '#2AC2B5',
  11. warning: '#F59211',
  12. danger: '#DF2525',
  13. },
  14. },
  15. presets: [
  16. presetUno(),
  17. presetAttributify(),
  18. presetIcons({
  19. // 图标默认样式
  20. extraProperties: {
  21. display: 'inline-block',
  22. height: '1em',
  23. width: '1em',
  24. },
  25. /* options */
  26. }),
  27. UnocssIcons(),
  28. // @ts-ignore
  29. presetRemToPx({ baseFontSize: 4 }), // 1rem = 4px
  30. ],
  31. rules: [
  32. [/^c-(\w+)$/, ([, d]) => ({ color: `#${d}` })],
  33. [/^fs-(\d+)$/, ([, d]) => ({ 'font-size': `${d}px` })],
  34. [
  35. /^c-(.*)$/,
  36. ([, c], { theme }) => {
  37. if (theme.colors[c]) return { color: theme.colors[c] }
  38. },
  39. ],
  40. // ['c-primary', { color: '#2AC2B5' }],
  41. ],
  42. shortcuts: {
  43. // 快捷方式到多个实用程序
  44. 'page-top-bar': 'fs-24 font-bold c-2c2c2c px-30 h-60 lh-60 bg-white mb-10 rounded-4',
  45. },
  46. })