---
name: fav-icon
description: One source PNG/SVG → complete favicon + app-icon set. Outputs favicon.ico (multi-size: 16, 32, 48), apple-touch-icon-180.png, android-chrome-192.png, android-chrome-512.png, mstile-150.png, plus a site.webmanifest and a copy-pasteable HTML <head> snippet. Optional --circle masks the icon into a circle, --trim removes alpha padding, --bg fills transparent areas with a hex color. Use when the user asks for favicons, app icons, icon set, "make icons for my site", or has a logo and needs every web/app icon size.
---


# fav-icon

One source image → a complete, drop-in favicon and app-icon set for any website.

## What you get

- `favicon.ico` — multi-size ICO containing 16x16, 32x32, 48x48
- `apple-touch-icon-180.png` — iOS home-screen icon
- `android-chrome-192.png` and `android-chrome-512.png` — Android / PWA
- `mstile-150.png` — Windows tile icon
- `site.webmanifest` — PWA manifest with all icons referenced
- `head_snippet.html` — copy-pasteable `<head>` lines

## Usage

```bash
python3 scripts/icons.py --input logo.png
python3 scripts/icons.py --input logo.svg --output ./public/icons --name "MyApp" --theme-color "#ff3366"
python3 scripts/icons.py --input mark.png --circle --bg "#000000"
python3 scripts/icons.py --input mark.png --trim --circle
```

## Flags

- `--input PATH` — source PNG or SVG (required)
- `--output DIR` — output folder (default: `<input>_icons`)
- `--bg HEX` — fill transparent areas with a hex color (e.g. `#000000`)
- `--circle` — mask the icon into a circle
- `--trim` — auto-crop transparent padding before resizing
- `--name STR` — app name for site.webmanifest (default: `App`)
- `--theme-color HEX` — theme color for manifest + meta tag (default: `#000000`)

## Notes

- SVG inputs are rasterized at 1024x1024 via cairosvg.
- PNG inputs load as RGBA; non-RGBA inputs are converted automatically.
- All resizes use Lanczos filtering.
- `pillow` and (for SVG) `cairosvg` auto-install on first run.

## Recipes

- **Make a circular dark-background icon from a transparent logo:**
  `python3 scripts/icons.py --input logo.png --trim --bg "#0b0b0b" --circle --name "Black"`
- **Just web favicons, square, transparent:**
  `python3 scripts/icons.py --input logo.png --output ./public`
