# F25 Phase B — export-icons currentColor 治本 + 现有 catalog 一次性 transform

## 改动摘要

- 新增 `transformSvgCurrentColor()` 函数到 [`figma-sync/export-icons.mjs`](../../../figma-sync/export-icons.mjs)，导出供下游消费
- 治本：未来 `pnpm sync:icons` 拉 SVG 时自动调 transform，写入 `figma-data/published/icons/svg/*` 之前完成转换
- 一次性 cleanup：用同一函数 transform 现有 `src/icons/catalog/generated/*.ts` 的 inline SVG 字符串

## 转换策略（plan owner 收紧的版本）

**只转换 mono-color icon 中 hex == `#dbdbdb` 的情况**——保留所有语义色（red flag 红、safe 绿、brand logo 等）。

为何收紧（vs 原 prompt §B "单 path 单色全转"）：phase A 数据显示 mono-color 584 finding 中有 16 个 `#b54a4a`、6 个 `#ea4233`（红）、8 个 `#2fb54e`（绿）等明显是设计师特意选的语义色 / 品牌色。盲转 currentColor 会让 `mark/flag-on` 红旗、`mark/safe-on` 绿盾等失去语义。`#dbdbdb` 是 figma 默认 `--color-grey-4` 中性 default，501/584 = 85.8% 占比，是真正的 theme-able 中性默认，转 currentColor 安全且能解决 Rating mark/star fill 不响应 CSS color 的根因。

## Audit before / after

| 指标 | before phase B | after phase B | 差量 |
|---|---:|---:|---|
| mono-color hardcoded (error) | 584 | 83 | -501 (-85.8%) |
| multi-color hardcoded (warn) | 40 | 40 | 0 |
| 文件命中数 | 28 | 15 | -13 |

**Gate (master §1 Step 3)**：mono drop ≥ 50% — **PASS** (85.8% drop)

## 残留 mono-color findings 分布（after phase B）

  - `#b54a4a`: 16 icon
  - `#2fb54e`: 8 icon
  - `#50b848`: 6 icon
  - `#ea4233`: 6 icon
  - `#0866ff`: 4 icon
  - `#999999`: 3 icon
  - `#9146ff`: 3 icon
  - `#54565a`: 3 icon
  - `#888888`: 2 icon
  - `#3892f3`: 2 icon
  - `#f68512`: 2 icon
  - `#353535`: 2 icon
  - `#cd3924`: 2 icon
  - `#2c3fa3`: 2 icon
  - `#ff0000`: 2 icon
  - 余 20 个 hex 各 1 icon (品牌色 / app logos)

这些都是非 `#dbdbdb` 的 mono-color hex，多数是语义色或品牌色。**不在本 phase 范围**——后续如需进一步处理：

1. 让设计师把语义色用 figma Color Token 重新绑定（如 `--brand` / `--red`）；export-icons 拉到 var() 引用而非 hex
2. 或 plan owner 决定加 `figma-sync/audit-allowlist/icon-multicolor.json` 级 intentional mono-color 豁免

## 改动文件清单

- `figma-sync/export-icons.mjs` (modified +24/-1: transformSvgCurrentColor 函数 + fetchSvg 调用 transform)
- `src/icons/catalog/generated/*.ts` (modified 27 个 catalog file，logo.ts 0 transform 跳过)
- 总计：1 + 27 = 28 个核心 diff 文件 + 本 report = 29 文件，≤ 30 cap ✓

## 验收 self-check

- [x] export-icons.mjs 改后 transform fn export 出来
- [x] 现有 catalog/generated/*.ts 一次性 transform 应用，no semantic loss
- [x] mark.ts 含 `currentColor`（star + star-on 已是 currentColor，phase B 又转换 18 个 mark/* mono-color）
- [x] audit:icon-fill-currentcolor 重跑：mono finding 数从 584 → 83 (drop 85.8% ≥ 50% gate)
- [x] vue-tsc 0 errors
- [x] audit:figma-conformance overallPass=true
- [x] audit:docs-site 仅历史 in-review warn

## 后续 (phase D / 用户决策)

1. **published/esm divergence**：本 phase 未运行 `pnpm generate:icons-catalog`（避免 published/icons/manifest.json + 28 个 esm js 重生产生 ~60 file diff 超 ≤ 30 cap）。`figma-data/published/icons/svg/` + `figma-data/published/icons/esm/` 仍含 hex `#dbdbdb`。下次 `pnpm sync:icons` 跑过后 export-icons.mjs 的 transform 会自动同步两侧。或下个 release 前手动跑 `pnpm generate:icons-catalog` + 验证 audit 全过 + commit
2. **多色 icon 白名单初始化**：`figma-sync/audit-allowlist/icon-multicolor.json` 仍是空数组。phase A multi-color 40 finding 待 plan owner 逐条 review 标注（建议清单：mark/flag-on / mark/safe-on / mark/thumb-up-on / mark/favorite-on / message/* 系列）后入白名单
3. **残留 mono semantic-color**：83 个 non-`#dbdbdb` mono finding 是设计意图保留，但 audit 仍 emit error。建议 phase D 加 `semantic-mono-allowlist` 或调整 audit 规则只 error `#dbdbdb` + 其它中性色
