ios-icon-gen
affaan-m/ECC
從 SF Symbols 或 Iconify API 產生 iOS 應用程式圖示,並以 PNG 圖像集格式儲存至 Xcode 資源目錄中。
...展開全部iOS 圖示產生器
從兩種來源為 Xcode 資源目錄產生 PNG 圖示圖集。
何時啟用
- 為 iOS/macOS Xcode 專案產生圖示資產
- 在開源圖庫中搜尋圖示
- 為資產目錄建立 PNG 圖集(1x、2x、3x)
- 將佔位符圖示替換為正式發行級別的資產
- 配合 Xcode 專案中現有的圖示風格
核心原則
1. 兩個來源,一種輸出格式
兩種來源皆可產生完全相同的、與 Xcode 相容的圖像集。請根據需求選擇:
| 來源 | 圖示 | 需求 | 最適合 |
|---|---|---|---|
| Iconify API | 來自 200 多個系列,共計 275,000 多個圖示 | 網路 | 選擇豐富、風格獨特、開源圖示 |
| SF Symbols | 5,000 多個 Apple 符號 | 僅限 macOS | Apple 原生風格,可離線使用 |
2. 始終與現有風格保持一致
生成前,請檢查專案中現有圖示的尺寸、顏色及粗細是否保持一致。
3. 輸出結構
兩種方法皆會產生完整的 Xcode 圖像集:
/.imageset/
Contents.json
.png # 1x (68px default)
@2x.png # 2x (136px default)
@3x.png # 3x (204px default)
範例
步驟 1:評估需求
確定圖示需求:圖示所代表的內容、偏好的風格、目標顏色及尺寸。
若專案中已有圖示,請檢查現有風格:
# Check dimensions of existing icon
sips -g pixelWidth -g pixelHeight path/to/[email protected]
步驟 2:搜尋圖示
Iconify API(推薦使用,選擇範圍廣泛):
# Search all collections
$SKILL_DIR/scripts/iconify_gen.sh search "receipt"
# Search within a specific collection
$SKILL_DIR/scripts/iconify_gen.sh search "business card" --prefix mdi
# List available collections
$SKILL_DIR/scripts/iconify_gen.sh collections
SF Symbols(適用於 Apple 原生風格): 瀏覽 SF Symbols 應用程式或參考常用名稱:
| 使用情境 | 圖示名稱 |
|---|---|
| 文件 | doc.text, doc.fill |
| 收據 | doc.text.below.ecg, receipt |
| 人物 | person.crop.rectangle, person.text.rectangle |
| 相機 | camera, camera.fill |
| 掃描 | doc.viewfinder, qrcode.viewfinder |
| 設定 | gearshape, slider.horizontal.3 |
步驟 3:預覽(可選)
# Iconify preview
$SKILL_DIR/scripts/iconify_gen.sh preview mdi:receipt-text-outline
步驟 4:產生
Iconify API:
# Basic generation
$SKILL_DIR/scripts/iconify_gen.sh mdi:receipt-text-outline editTool_expenseReport
# Custom color and output location
$SKILL_DIR/scripts/iconify_gen.sh mdi:receipt-text-outline myIcon --color 007AFF --output ./Assets.xcassets/icons
選項: --size (預設:68), --color (預設:8E8E93), --output (預設:/tmp/icons)
SF 符號:
# Basic generation
swift $SKILL_DIR/scripts/generate_icons.swift doc.text.below.ecg editTool_expenseReport
# Custom color, weight, and output
swift $SKILL_DIR/scripts/generate_icons.swift person.crop.rectangle myIcon --color 007AFF --weight regular --output ./Assets.xcassets/icons
選項: --size (預設:68), --color (預設:8E8E93), --weight (預設:細體), --output (預設:/tmp/icons)
步驟 5:驗證與整合
- 讀取生成的 @2x PNG 檔案以進行視覺驗證
- 若未直接輸出至資產目錄,請手動複製至該處:
cp -r /tmp/icons/.imageset path/to/Assets.xcassets/ / - 編譯專案以確認 Xcode 能否讀取新資產
熱門 Iconify 圖示集
| 前綴 | 名稱 | 數量 | 樣式 |
|---|---|---|---|
mdi |
Material Design 圖示 | 7400+ | 實心 + 輪廓變體 |
ph |
磷光體 | 9000+ | 每個圖示 6 種粗細 |
solar |
Solar | 7400+ | 粗體、線性、輪廓 |
tabler |
Tabler 圖示 | 6000+ | 筆畫寬度一致 |
lucide |
Lucide | 1700+ | 簡潔、極簡 |
ri |
Remix Icon | 3100+ | 實心 + 線條變體 |
carbon |
碳纖維 | 2400+ | IBM 設計語言 |
heroicons |
HeroIcons | 1200+ | Tailwind CSS 配套工具 |
瀏覽全部:https://icon-sets.iconify.design/
腳本參考
| 腳本 | 原始碼 | 路徑 |
|---|---|---|
iconify_gen.sh |
Iconify API(超過 27.5 萬個圖示) | $SKILL_DIR/scripts/iconify_gen.sh |
generate_icons.swift |
SF Symbols(5k+ 圖示) | $SKILL_DIR/scripts/generate_icons.swift |
最佳實務
- 生成前先搜尋——瀏覽現有圖示以找出最合適的選項
- 配合現有專案風格 —— 生成新圖示前,請先確認現有圖示的尺寸、顏色及粗細
- 善用 Iconify 豐富多樣的圖示資源——超過 200 個圖示系列,讓您能精準找到所需的風格
- 使用 SF Symbols 以確保與 Apple 系統的一致性 — 這些圖示能完美契合系統介面
- 直接生成至資源目錄 —— 使用
--output ./Assets.xcassets/icons跳過手動複製的步驟 - 視覺驗證 —— 提交前務必預覽 @2x PNG 檔案
反模式
- 生成圖標時未檢查專案現有的圖標風格
- 當專案已定義色彩方案時,仍使用預設顏色
- 以錯誤尺寸生成圖示(請先檢查現有圖示)
- 未經視覺驗證即提交生成的圖示
---
name: ios-icon-gen
description: Generate iOS app icons as PNG imagesets for Xcode asset catalogs from SF Symbols or the Iconify API.
---
# iOS Icon Generator
Generate PNG icon imagesets for Xcode asset catalogs from two sources.
## When to Activate
- Generating icon assets for an iOS/macOS Xcode project
- Searching for icons across open source collections
- Creating PNG imagesets (1x, 2x, 3x) for asset catalogs
- Replacing placeholder icons with production-quality assets
- Matching existing icon styles in an Xcode project
## Core Principles
### 1. Two Sources, One Output Format
Both sources produce identical Xcode-compatible imagesets. Choose based on need:
| Source | Icons | Requires | Best for |
|--------|-------|----------|----------|
| **Iconify API** | 275,000+ from 200+ collections | Internet | Wide selection, specific styles, open source icons |
| **SF Symbols** | 5,000+ Apple symbols | macOS only | Apple-native style, offline use |
### 2. Always Match Existing Style
Before generating, check the project's existing icons for size, color, and weight consistency.
### 3. Output Structure
Both methods produce a complete Xcode imageset:
```
<output-dir>/<asset-name>.imageset/
Contents.json
<asset-name>.png # 1x (68px default)
<asset-name>@2x.png # 2x (136px default)
<asset-name>@3x.png # 3x (204px default)
```
## Examples
### Step 1: Assess Requirements
Determine icon needs: what the icon represents, preferred style, target color, and size.
If the project already has icons, check existing style:
```bash
# Check dimensions of existing icon
sips -g pixelWidth -g pixelHeight path/to/[email protected]
```
### Step 2: Search for Icons
**Iconify API (recommended for wide selection):**
```bash
# Search all collections
$SKILL_DIR/scripts/iconify_gen.sh search "receipt"
# Search within a specific collection
$SKILL_DIR/scripts/iconify_gen.sh search "business card" --prefix mdi
# List available collections
$SKILL_DIR/scripts/iconify_gen.sh collections
```
**SF Symbols (for Apple-native style):**
Browse the SF Symbols app or reference common names:
| Use Case | Symbol Name |
|----------|-------------|
| Document | `doc.text`, `doc.fill` |
| Receipt | `doc.text.below.ecg`, `receipt` |
| Person | `person.crop.rectangle`, `person.text.rectangle` |
| Camera | `camera`, `camera.fill` |
| Scan | `doc.viewfinder`, `qrcode.viewfinder` |
| Settings | `gearshape`, `slider.horizontal.3` |
### Step 3: Preview (Optional)
```bash
# Iconify preview
$SKILL_DIR/scripts/iconify_gen.sh preview mdi:receipt-text-outline
```
### Step 4: Generate
**Iconify API:**
```bash
# Basic generation
$SKILL_DIR/scripts/iconify_gen.sh mdi:receipt-text-outline editTool_expenseReport
# Custom color and output location
$SKILL_DIR/scripts/iconify_gen.sh mdi:receipt-text-outline myIcon --color 007AFF --output ./Assets.xcassets/icons
```
Options: `--size <pt>` (default: 68), `--color <hex>` (default: 8E8E93), `--output <dir>` (default: /tmp/icons)
**SF Symbols:**
```bash
# Basic generation
swift $SKILL_DIR/scripts/generate_icons.swift doc.text.below.ecg editTool_expenseReport
# Custom color, weight, and output
swift $SKILL_DIR/scripts/generate_icons.swift person.crop.rectangle myIcon --color 007AFF --weight regular --output ./Assets.xcassets/icons
```
Options: `--size <pt>` (default: 68), `--color <hex>` (default: 8E8E93), `--weight <name>` (default: thin), `--output <dir>` (default: /tmp/icons)
### Step 5: Verify and Integrate
1. Read the generated @2x PNG to verify visually
2. Copy to asset catalog if not output there directly:
```bash
cp -r /tmp/icons/<name>.imageset path/to/Assets.xcassets/<group>/
```
3. Build the project to verify Xcode picks up the new assets
## Popular Iconify Collections
| Prefix | Name | Count | Style |
|--------|------|-------|-------|
| `mdi` | Material Design Icons | 7400+ | Filled + outline variants |
| `ph` | Phosphor | 9000+ | 6 weights per icon |
| `solar` | Solar | 7400+ | Bold, linear, outline |
| `tabler` | Tabler Icons | 6000+ | Consistent stroke width |
| `lucide` | Lucide | 1700+ | Clean, minimal |
| `ri` | Remix Icon | 3100+ | Filled + line variants |
| `carbon` | Carbon | 2400+ | IBM design language |
| `heroicons` | HeroIcons | 1200+ | Tailwind CSS companion |
Browse all: <https://icon-sets.iconify.design/>
## Scripts Reference
| Script | Source | Path |
|--------|--------|------|
| `iconify_gen.sh` | Iconify API (275k+ icons) | `$SKILL_DIR/scripts/iconify_gen.sh` |
| `generate_icons.swift` | SF Symbols (5k+ icons) | `$SKILL_DIR/scripts/generate_icons.swift` |
## Best Practices
- **Search before generating** -- browse available icons to find the best match
- **Match existing project style** -- check dimensions, color, and weight of existing icons before generating new ones
- **Use Iconify for variety** -- 200+ collections means you can find the exact style you need
- **Use SF Symbols for Apple consistency** -- they match system UI perfectly
- **Generate directly to asset catalog** -- use `--output ./Assets.xcassets/icons` to skip manual copying
- **Verify visually** -- always preview the @2x PNG before committing
## Anti-Patterns
- Generating icons without checking existing project icon style
- Using default colors when the project has a defined color palette
- Generating at wrong sizes (check existing icons first)
- Committing generated icons without visual verification
安裝 ios-icon-gen
請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。
下載 ZIP複製儲存庫並將技能檔案複製到您的專案中。
git clone https://github.com/affaan-m/ECC/tree/main/skills/ios-icon-gen # Copy SKILL.md to your .claude/skills/ directory
複製





首頁
