罗广辉
2026-06-18 44dd9c4eb8a2489c63a5eb53fd4254bbb3510e95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * @Author       : yuan
 * @Date         : 2025-09-28 09:31:16
 * @LastEditors  : yuan
 * @LastEditTime : 2025-09-28 09:38:38
 * @FilePath     : \uno.config.js
 * @Description  : 
 * Copyright 2025 OBKoro1, All Rights Reserved. 
 * 2025-09-28 09:31:16
 */
import {
  defineConfig,
  presetIcons,
  transformerDirectives,
  transformerVariantGroup
} from "unocss"
import { presetWeapp } from "unocss-preset-weapp"
import {
  extractorAttributify,
  transformerClass
} from "unocss-preset-weapp/transformer"
 
const {
  presetWeappAttributify,
  transformerAttributify
} = extractorAttributify()
 
export default defineConfig({
  presets: [
    // https://github.com/MellowCo/unocss-preset-weapp
    presetWeapp(),
    presetWeappAttributify(),
    // https://unocss.dev/presets/icons
    presetIcons({
      scale: 1.2,
      warn: true,
      extraProperties: {
        display: "inline-block",
        "vertical-align": "middle"
      }
    })
  ],
  /**
   * 自定义快捷语句
   * @see https://github.com/unocss/unocss#shortcuts
   */
  shortcuts: {
    "border-base": "border border-gray-500_10",
    center: "flex justify-center items-center"
  },
  theme: {
    colors: {
      // 主题颜色
      primary: "var(--theme-primary)",
      success: "var(--theme-success)",
      warning: "var(--theme-warning)",
      error: "var(--theme-error)",
      // 文字颜色
      "text-main": "var(--theme-main-color)",
      "text-content": "var(--theme-content-color)",
      "text-tips": "var(--theme-tips-color)",
      "text-light": "var(--theme-light-color)",
      "text-disabled": "var(--theme-disabled-color)",
      // 背景颜色
      "bg-main": "var(--theme-bg-color)",
      "bg-secondary": "var(--theme-bg-color-secondary)",
      // 边框颜色
      "border-main": "var(--theme-border-color)"
    }
  },
  transformers: [
    // 启用 @apply 功能
    transformerDirectives({
      enforce: "pre"
    }),
    // https://unocss.dev/transformers/variant-group
    // 启用 () 分组功能
    transformerVariantGroup(),
    transformerAttributify(),
    // https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
    transformerClass()
  ]
})