appicons
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseApp Icons (agent-first)
应用图标(Agent优先)
Generate a full favicon / app-icon stack and install it into the current
project in one shot. The whole flow is a single command — there is no UI to
click, no zip to download, and no files to move. A brand-new app shipping with
a blank tab icon looks unfinished; this is the fastest way to fix that.
一键生成完整的favicon/app-icon图标栈并安装到当前项目中。整个流程只需一条命令——无需点击UI、无需下载压缩包、无需手动移动文件。全新应用如果带着空白标签页图标发布,会显得不够完善;这是最快的解决方法。
When to use
使用场景
- User wants a favicon / tab icon / site icon / app icon / PWA icons.
- User points at a logo, an emoji ("a fox"), a brand ("the React logo"), or an existing site's icon and wants it turned into a proper icon set.
- A new web project has no favicon yet, or still has the framework default.
- 用户需要favicon/标签页图标/网站图标/应用图标/PWA图标。
- 用户指向某个logo、emoji(比如“一只狐狸”)、品牌(比如“React标志”)或现有网站的图标,希望将其转换为标准图标集。
- 新的Web项目还没有favicon,或者仍使用框架默认图标。
Defaults (no manual input needed)
默认设置(无需手动输入)
This skill is built so you can act on intent alone. Unless the user says
otherwise, generate the full per-stage set:
- theme-aware light/dark favicons, and
- per-environment variants — a clean production icon plus badged
staging () and dev (
S) icons, each with its own manifest.D
That's the defaults below. Only drop them
( / ) if the user explicitly wants a single
plain icon.
--badges --theme-aware--no-badges--no-theme-aware本工具的设计支持仅根据用户意图操作。除非用户另有说明,默认生成全环境阶段图标集:
- 支持主题适配的明暗favicon,以及
- 分环境变体——简洁的生产环境图标,加上带有标记的预发布()和开发(
S)环境图标,每个环境都有独立的manifest文件。D
这对应下方的默认参数。只有当用户明确需要单一纯色图标时,才移除这些参数(/)。
--badges --theme-aware--no-badges--no-theme-awareStep 1 — Pick the source
步骤1 — 选择来源
The generator accepts three kinds of . Choose based on what the user gave you:
--source| User gave you… | Use | Example |
|---|---|---|
| A local logo/image | the file path | |
| A URL to an image/logo | the URL | |
| A vibe / emoji / brand name | an Iconify name | |
For the Iconify path you translate the user's intent into a :
prefix:name- Emoji → (or
noto:,twemoji:). "a rocket" →fluent-emoji:, "fox" →noto:rocket, "purple heart" →noto:fox.noto:purple-heart - Brand / product logo → or
simple-icons:. "React" →logos:, "GitHub" →simple-icons:react, "Stripe" →logos:github-icon.simple-icons:stripe - UI / line icon → ,
lucide:, ormdi:. "a camera" →tabler:.lucide:camera
If unsure an icon name exists, browse https://icon-sets.iconify.design or just
try it — the script errors clearly if the name is unknown, then pick another.
If the project already has a logo, prefer it over an emoji.
生成器接受三种类型的参数。根据用户提供的内容选择:
--source| 用户提供了… | 使用方式 | 示例 |
|---|---|---|
| 本地logo/图片 | 文件路径 | |
| 图片/logo的URL | URL地址 | |
| 风格/emoji/品牌名称 | Iconify名称 | |
对于Iconify路径,需将用户的意图转换为格式:
prefix:name- Emoji → 使用(或
noto:、twemoji:)。比如“火箭”→fluent-emoji:,“狐狸”→noto:rocket,“紫心”→noto:fox。noto:purple-heart - 品牌/产品标志 → 使用或
simple-icons:。比如“React”→logos:,“GitHub”→simple-icons:react,“Stripe”→logos:github-icon。simple-icons:stripe - UI/线性图标 → 使用、
lucide:或mdi:。比如“相机”→tabler:。lucide:camera
Step 2 — Generate (writes files directly)
步骤2 — 生成(直接写入文件)
bash
scripts/favicon-gen.sh --source <file|url|prefix:name> --out <public-dir> [options]Pick to match the framework's static dir (see Step 3). Options:
--out- — background fill (default
--bg none|white|black/transparent). Emoji and line icons usually look best onnone+white.--shape circular --shape square|circular- +
--variant badge|color— how staging/dev are marked.--primary "#7c3aed"(default) adds a corner S/D letter;badgetints them fromcolor.--primary - — single production icon only (skip dev/staging variants).
--no-badges - — skip the light/dark 16×16 favicons.
--no-theme-aware
Examples:
bash
undefinedbash
scripts/favicon-gen.sh --source <file|url|prefix:name> --out <public-dir> [options]选择参数以匹配框架的静态文件目录(见步骤3)。可选参数:
--out- — 背景填充色(默认
--bg none|white|black/透明)。Emoji和线性图标通常在none背景+white时效果最佳。--shape circular - — 图标形状
--shape square|circular - +
--variant badge|color— 预发布/开发环境图标的标记方式。默认--primary "#7c3aed"会在角落添加S/D字母;badge会使用color指定的颜色为图标着色。--primary - — 仅生成单一生产环境图标(跳过开发/预发布变体)。
--no-badges - — 跳过支持明暗主题的16×16尺寸favicon。
--no-theme-aware
示例:
bash
undefinedDefault: emoji favicon, polished, with theme-aware + per-stage variants
默认:emoji favicon,优化版,支持主题适配+分环境变体
scripts/favicon-gen.sh --source noto:fox --bg white --shape circular --out ./public
scripts/favicon-gen.sh --source noto:fox --bg white --shape circular --out ./public
From the project's own logo (still per-stage by default)
使用项目自身的logo(默认仍生成分环境变体)
scripts/favicon-gen.sh --source ./public/logo.svg --out ./public
scripts/favicon-gen.sh --source ./public/logo.svg --out ./public
Brand mark, color-tinted stage variants instead of letter badges
品牌标志,使用颜色标记分环境变体而非字母徽章
scripts/favicon-gen.sh --source simple-icons:react --variant color --primary "#61dafb" --out ./public
scripts/favicon-gen.sh --source simple-icons:react --variant color --primary "#61dafb" --out ./public
Just a single plain icon, no stages
仅生成单一纯色图标,不分环境
scripts/favicon-gen.sh --source ./logo.png --no-badges --out ./public
The script writes the icon files (`favicon.ico`, `favicon-16/32/48/96`,
`apple-touch-icon.png`, `android-icon-192x192.png`, `manifest.json`, theme
variants, and `staging-*`/`dev-*` + `staging-manifest.json`/`dev-manifest.json`
when stages are on) into `--out`, and prints a `<head>` snippet, also saved to
`<out>/.favicon-head.html`.scripts/favicon-gen.sh --source ./logo.png --no-badges --out ./public
脚本会将图标文件(`favicon.ico`、`favicon-16/32/48/96`、`apple-touch-icon.png`、`android-icon-192x192.png`、`manifest.json`、主题变体,以及开启分环境时的`staging-*`/`dev-*`和`staging-manifest.json`/`dev-manifest.json`)写入`--out`目录,同时输出一段`<head>`代码片段,该片段也会保存到`<out>/.favicon-head.html`文件中。Step 3 — Install the tags (framework-aware)
步骤3 — 安装标签(支持框架适配)
Place the icons in the right static dir and wire up the . Detect the
framework from the repo, then:
<head>- Next.js (App Router) → . Next auto-serves
--out ./public/appicons, but for the full set add topublicmetadata or drop theapp/layout.tsxsnippet's<head>s into the root layout.<link>→ link viamanifest.jsonor ametadata.manifest.<link rel="manifest"> - Next.js (Pages) / CRA / Vite / plain HTML → and paste the contents of
--out ./publicinto the.favicon-head.htmlof<head>(orindex.html/_document). All paths are already root-relative (app.html)./favicon.ico - Vite/Astro/SvelteKit → static dir is usually (Astro/Svelte) — confirm and pass it to
./public. Then add the snippet to the base HTML.--out
After patching, delete or replace any pre-existing /
so the old icon doesn't win the cache. In Next.js, files in
(e.g. ) override — remove the stale one.
favicon.ico<link rel="icon">app/app/favicon.icopublic/将图标放置在正确的静态文件目录并配置标签。从代码仓库中检测框架,然后:
<head>- Next.js(App Router) → 设置。Next.js会自动提供
--out ./public/app目录下的图标,但要使用完整图标集,需将代码片段中的public标签添加到<link>的元数据中,或者添加到根布局的app/layout.tsx里。<head>可通过manifest.json或metadata.manifest进行关联。<link rel="manifest"> - Next.js(Pages)/ CRA / Vite / 纯HTML → 设置,并将
--out ./public中的内容粘贴到.favicon-head.html(或index.html/_document)的app.html标签中。所有路径均已设置为根相对路径(如<head>)。/favicon.ico - Vite/Astro/SvelteKit → 静态文件目录通常为(Astro/Svelte)——确认后将其传入
./public参数,然后将代码片段添加到基础HTML文件中。--out
完成修补后,删除或替换所有已存在的/标签,避免旧图标因缓存问题生效。在Next.js中,目录下的文件(如)会覆盖目录下的文件——请移除旧的图标文件。
favicon.ico<link rel="icon">app/app/favicon.icopublic/Step 3.5 — Wire up the stages (when per-stage variants are on)
步骤3.5 — 配置分环境逻辑(当开启分环境变体时)
When you generated stages (the default), don't hard-code production-only tags.
Render the icon set conditionally off the deploy environment so production
shows the clean icon while staging/dev show their badged ones. The variants
follow a filename-prefix convention: (prod), , .
//staging-/dev-Next.js / React — in (or a component):
app/layout.tsx<FaviconHead>tsx
const isStaging = process.env.NEXT_PUBLIC_APP_ENV === "staging";
const isDev = process.env.NODE_ENV === "development";
const prefix = isDev ? "/dev-" : isStaging ? "/staging-" : "/";
const manifest = isDev
? "/dev-manifest.json"
: isStaging
? "/staging-manifest.json"
: "/manifest.json";
// <link rel="icon" href={`${prefix}favicon.ico`} />
// <link rel="icon" type="image/png" sizes="32x32" href={`${prefix}favicon-32x32.png`} />
// <link rel="apple-touch-icon" href={`${prefix}apple-touch-icon.png`} />
// <link rel="manifest" href={manifest} />Vite / Vue — .
const prefix = import.meta.env.DEV ? '/dev-' : import.meta.env.VITE_APP_ENV === 'staging' ? '/staging-' : '/'Astro — key off . SvelteKit — same idea in .
import.meta.env.PUBLIC_APP_ENV+layout.svelteMake sure the / land in the static
dir too, and suffix each manifest's / per stage, e.g.
, , . Set to the page users
should land on ( for marketing, for admin apps).
staging-manifest.jsondev-manifest.jsonnameshort_name"Acme""Acme (Staging)""Acme (Dev)"start_url//dashboard当生成分环境变体(默认开启)时,不要硬编码仅适用于生产环境的标签。需根据部署环境条件渲染图标集,使生产环境显示简洁图标,而预发布/开发环境显示带有标记的变体。变体遵循文件名前缀约定:(生产)、、。
//staging-/dev-Next.js / React — 在(或组件)中:
app/layout.tsx<FaviconHead>tsx
const isStaging = process.env.NEXT_PUBLIC_APP_ENV === "staging";
const isDev = process.env.NODE_ENV === "development";
const prefix = isDev ? "/dev-" : isStaging ? "/staging-" : "/";
const manifest = isDev
? "/dev-manifest.json"
: isStaging
? "/staging-manifest.json"
: "/manifest.json";
// <link rel="icon" href={`${prefix}favicon.ico`} />
// <link rel="icon" type="image/png" sizes="32x32" href={`${prefix}favicon-32x32.png`} />
// <link rel="apple-touch-icon" href={`${prefix}apple-touch-icon.png`} />
// <link rel="manifest" href={manifest} />Vite / Vue — 使用。
const prefix = import.meta.env.DEV ? '/dev-' : import.meta.env.VITE_APP_ENV === 'staging' ? '/staging-' : '/'Astro — 根据判断。SvelteKit — 在中使用相同逻辑。
import.meta.env.PUBLIC_APP_ENV+layout.svelte确保/也存入静态文件目录,并为每个manifest的/添加环境后缀,例如、、。设置为用户应进入的页面(营销网站设为,管理应用设为)。
staging-manifest.jsondev-manifest.jsonnameshort_name"Acme""Acme (Staging)""Acme (Dev)"start_url//dashboardStep 4 — Verify
步骤4 — 验证
- Confirm the files exist in the static dir (at minimum ,
favicon.ico,favicon-32x32.png,apple-touch-icon.png— plus themanifest.json/staging-*files when stages are on).dev-* - Confirm the (or layout metadata) references them, and that the stage logic resolves to the right files.
<head> - Report the coverage (which sizes/variants/stages were produced) to the user.
- If a dev server is running, the favicon may be cached — mention a hard refresh.
- 确认静态文件目录中存在所需文件(至少包含、
favicon.ico、favicon-32x32.png、apple-touch-icon.png——开启分环境时还需包含manifest.json/staging-*文件)。dev-* - 确认(或布局元数据)已正确引用这些文件,且分环境逻辑能解析到正确的文件。
<head> - 向用户报告生成的覆盖范围(包括哪些尺寸、变体、环境阶段的图标已生成)。
- 如果开发服务器正在运行,favicon可能被缓存——提醒用户强制刷新页面。
Notes
注意事项
- Network is required (calls ). Override the endpoint with
favicontools.comor the--apienv var (e.g. a self-hosted instance).FAVICON_API - The API rasterizes SVG sources server-side, so vector logos and Iconify icons come out crisp at every size.
- Requires ,
curl, and eitherunziporpython3(for JSON parsing).jq
- 需要网络连接(调用)。可通过
favicontools.com参数或--api环境变量覆盖端点(例如自托管实例)。FAVICON_API - API会在服务器端将SVG来源栅格化,因此矢量logo和Iconify图标在所有尺寸下都能保持清晰。
- 需要依赖、
curl,以及unzip或python3(用于JSON解析)。jq
Alternative: the MCP server
替代方案:MCP服务器
If the user runs an MCP-aware agent, they can add the Favicon Tools MCP server
instead of this script:
json
{ "mcpServers": { "favicontools": { "type": "http", "url": "https://favicontools.com/api/mcp" } } }It exposes and ; also
returns per-stage variants and a stage-aware head snippet by default, then
hands back CDN URLs for every file. Use whichever fits the environment.
search_inputsgenerate_iconsetgenerate_iconset如果用户运行支持MCP的Agent,可以添加Favicon Tools MCP服务器来替代本脚本:
json
{ "mcpServers": { "favicontools": { "type": "http", "url": "https://favicontools.com/api/mcp" } } }它暴露了和接口;默认也会返回分环境变体和支持分环境的<head>代码片段,然后返回所有文件的CDN URL。可根据环境选择合适的方式。
search_inputsgenerate_iconsetgenerate_iconsetProvenance
来源
- Generation API: (public, no auth).
POST https://favicontools.com/api/favicons - Icon/emoji lookup: Iconify — (public). Browse names at https://icon-sets.iconify.design.
https://api.iconify.design/<prefix>/<name>.svg - Built from the source project . This skill uses only the public website API above — it contains no private source.
mewc/favicon-generator
- 生成API:(公开,无需认证)。
POST https://favicontools.com/api/favicons - 图标/emoji查询:Iconify — (公开)。可在https://icon-sets.iconify.design浏览图标名称。
https://api.iconify.design/<prefix>/<name>.svg - 基于开源项目构建。本工具仅使用上述公开网站API——不包含任何私有源代码。
mewc/favicon-generator