# Miniprogram Icon Downloader

> Mini Program Icon Downloader

- Skill: `shyxin/miniprogram-icon-downloader` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add shyxin/miniprogram-icon-downloader`
- Raw SKILL.md: https://api.skillmd.com/api/skills/shyxin/miniprogram-icon-downloader/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: shyxin (https://skillmd.com/u/shyxin)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/shyxin/miniprogram-icon-downloader

---

# Mini Program Icon Downloader

A skill for downloading icons and images for WeChat Mini Program projects. Search icons from Icons8 API and download them using curl or other tools. Supports TabBar icon download with 81x81 size specification.

## Features

- Download TabBar icons for mini program
- Download images from Icons8 API directly
- Search and download icons with specific sizes and platforms
- Download multiple icon sets for different states (normal/active)
- Initialize new mini program projects with standard icon sets

## Installation

### Installation via Skills (Recommended)

```bash
# Install the skill using npx
npx skills add SHYXIN/miniprogram-icon-downloader
```

### Manual Installation

```bash
# Install dependencies
pip install requests

# Download the skill file
curl -s -o miniprogram_icon_downloader.py https://raw.githubusercontent.com/SHYXIN/miniprogram-icon-downloader/main/miniprogram_icon_downloader.py
```

This skill uses curl for downloading files. Ensure curl is available in your environment.

## Usage

### Basic Usage

```python
from miniprogram_icon_downloader import download_icons

tabs = [
  { "name": "ai", "text": "AI创作", "search_query": "ai brain artificial intelligence" },
  { "name": "dev", "text": "开发工具", "search_query": "code programming developer" },
  { "name": "text", "text": "文本工具", "search_query": "text document editing" },
  { "name": "material", "text": "素材库", "search_query": "library collection folder" }
]

download_icons('path/to/your/mini-program', tabs)
```

### Custom Configuration

```python
from miniprogram_icon_downloader import download_icons

customIcons = [
  { "name": "home", "search_query": "home house", "size": 64 },
  { "name": "profile", "search_query": "user profile", "size": 64 },
  { "name": "settings", "search_query": "settings gear", "size": 64 }
]

download_icons('path/to/your/mini-program', customIcons, {
  "icon_dir": "assets/icons",
  "states": ["normal"]
})
```

### Search and Download Manually

```python
from miniprogram_icon_downloader import search_icons, download_single_icon

# Search for icons
icons = search_icons("camera", 81, "ios", 5)

# Download first result
if len(icons) > 0:
    download_single_icon(icons[0]["url"], "camera", "path/to/icons")
```

## API Reference

### download_icons(project_path, icon_configs, options={})

Download icons for mini program projects with flexible configuration using Icons8 API.

**Parameters:**
- `project_path`: Path to mini program project directory
- `icon_configs`: Array of icon configuration objects
- `options`: Configuration options

**Icon Configuration Object:**
```python
{
  "name": "icon_name",           # Icon filename prefix
  "search_query": "search term",  # Search query for Icons8 API
  "text": "Tab text",           # TabBar text (optional)
  "size": 81,                   # Icon size (default: 81)
  "platform": "ios",            # Icon platform (default: "ios")
  "states": ["normal", "active"] # Icon states to download (default: ["normal", "active"])
}
```

**Options:**
```python
{
  "icon_dir": "images",         # Icon directory (default: "images")
  "states": ["normal", "active"] # Icon states to download (default: ["normal", "active"])
}
```

### search_icons(query, size=81, platform='fluent', amount=1)

Search for icons using Icons8 API.

**Parameters:**
- `query`: Search term for the icon
- `size`: Size of the icon in pixels (default: 81)
- `platform`: Icon platform/style (default: 'ios')
- `amount`: Number of results to return (default: 1)

**Returns:**
List of icon objects with URL and metadata.

### download_icon(url, output_path)

Download a single icon from URL to specified path.

**Parameters:**
- `url`: URL of the icon
- `output_path`: Output file path

## Icon Size Specifications

For WeChat Mini Program:

- **TabBar icons**: 81x81 pixels (recommended)
- **Navigation icons**: 24x24 to 32x32 pixels
- **Action icons**: 48x48 pixels
- **Large icons**: 128x128 pixels

## Search Tips

Use these general approaches for better icon search results:
- Use simple, descriptive terms (e.g., "home", "user", "settings")
- Try action words for functions (e.g., "search", "download", "edit")
- Use object names for items (e.g., "phone", "computer", "car")
- Consider synonyms if first search doesn't work
- Think about what the icon represents conceptually
- Use single words or short phrases for best results

## Error Handling

The skill handles common errors:
- Icon not found in search results
- Download failures
- File system errors

If an icon cannot be downloaded, the skill will skip it and continue with others.

## Dependencies

- **curl**: Must be available in the system
- **Python 3.7+**: Must be installed
- **requests**: `pip install requests`
- **Icons8 API access**: Direct API access to https://api.icons8.com

## Notes

- All icons are downloaded to `project_path/{icon_dir}/` directory
- Icon filenames follow the pattern: `{name}-{state}.png`
- The skill automatically handles both normal and active state icons
- For TabBar, ensure icons are placed in the correct directory structure
- Supports custom icon sizes and platforms

## Best Practices

1. **Consistent naming**: Use clear, descriptive icon names
2. **Standard sizes**: Use 81x81 for TabBar, 24x24 for navigation
3. **Color consistency**: Choose icons that match your design system
4. **Error handling**: Implement proper error handling in production
5. **Caching**: Consider caching downloaded icons for repeated use
