选项
首页首页 Skill 其他 ios-icon-gen

ios-icon-gen

affaan-m/ECC affaan-m/ECC

从 SF Symbols 或 Iconify API 生成 iOS 应用图标,并将其作为 PNG 图像集导出到 Xcode 资源目录中。

...展开全部
0
更新时间 2026-10-01

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 步:验证与集成

  1. 阅读生成的 @2x PNG 文件进行目视验证
  2. 若未直接输出至资源目录,请复制到该目录:
    cp -r /tmp/icons/.imageset path/to/Assets.xcassets//
    
  3. 构建项目以验证 Xcode 是否已加载新资源

热门 Iconify 图标集

前缀 名称 数量 样式
mdi Material Design 图标 7400+ 实心 + 轮廓变体
ph Phosphor 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 系统保持一致——它们与系统 UI 完美契合
  • 直接生成到资源目录——使用 --output ./Assets.xcassets/icons 跳过手动复制
  • 进行视觉验证——提交前务必预览 @2x PNG 文件

反模式

  • 生成图标时未检查项目中现有的图标风格
  • 在项目已定义配色方案时仍使用默认颜色
  • 生成错误尺寸的图标(请先检查现有图标)
  • 未进行目视核验就提交生成的图标
在 GitHub 上查看
---
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

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ Claude 会自动检测并使用该技能
仓库 affaan-m/ECC

相关技能

multica-creating-agents
更新时间 2026-08-12
tilemaps
更新时间 2026-08-04
v4-new-features
更新时间 2026-08-04
agent-github-pr-manager
更新时间 2026-08-03
OR