--- name: favicon-gen description: | Generate custom favicons from logos, text, or brand colors - prevents launching with CMS defaults. Extract icons from logos, create monogram favicons from initials, or use branded shapes. Outputs all required formats: favicon.svg, favicon.ico, apple-touch-icon.png, and web app manifest. Use when: initializing new websites, replacing WordPress/CMS default favicons, converting logos to favicons, creating branded icons from text only, or troubleshooting favicon not displaying, iOS icon transparency, or missing manifest files. --- # Favicon Generator **Status**: Production Ready ✅ **Last Updated**: 2026-01-14 **Dependencies**: None (generates pure SVG/converts to ICO and PNG) **Latest Versions**: N/A (no package dependencies) --- ## Quick Start (5 Minutes) ### Decision Tree: Choose Your Approach ``` Do you have a logo with an icon element? ├─ YES → Extract icon from logo (Method 1) └─ NO ├─ Do you have text/initials? │ ├─ YES → Create monogram favicon (Method 2) │ └─ NO → Use branded shape (Method 3) ``` ### Method 1: Extract Icon from Logo **When to use**: Logo includes a standalone icon element (symbol, lettermark, or geometric shape) ```bash # 1. Identify the icon element in your logo SVG # 2. Copy just the icon paths/shapes # 3. Center in 32x32 viewBox # 4. Simplify for small sizes (remove fine details) ``` **Example**: Logo with rocket ship → Extract just the rocket shape ### Method 2: Create Monogram Favicon **When to use**: Only have business name, no logo yet ```bash # 1. Choose 1-2 letters (initials or brand abbreviation) # 2. Pick shape template (circle, rounded square, shield) # 3. Set brand colors # 4. Generate SVG ``` **Example**: "Acme Corp" → "AC" monogram in circle ### Method 3: Branded Shape Favicon **When to use**: No logo, no strong text identity, need something now ```bash # 1. Choose industry-relevant shape # 2. Apply brand colors # 3. Generate SVG ``` **Example**: Tech startup → Hexagon with gradient --- ## Critical Rules ### Always Do ✅ **Generate ALL required formats**: - `favicon.svg` (modern browsers, scalable) - `favicon.ico` (legacy browsers, 16x16 and 32x32) - `apple-touch-icon.png` (180x180, iOS) - `icon-192.png` (Android) - `icon-512.png` (Progressive Web Apps) ✅ **Use solid backgrounds for iOS** (transparent = black box on iOS) ✅ **Test at 16x16** (smallest display size) ✅ **Keep designs simple** (3-5 shapes max, no fine details) ✅ **Match brand colors** exactly ### Never Do ❌ **NEVER use CMS default favicons** (WordPress "W", Wix, Squarespace, etc.) ❌ **Don't use transparent backgrounds on iOS icons** (appears as black square) ❌ **Don't use complex illustrations** (illegible at small sizes) ❌ **Don't skip the web manifest** (required for PWA, Android home screen) ❌ **Don't forget the ICO fallback** (still needed for IE/legacy) --- ## The 4-Step Favicon Generation Process ### Step 1: Create Source SVG (favicon.svg) **For extracted logo icons**: ```xml ``` **For monogram favicons** (use templates in `templates/`): ```xml ``` **Key Points**: - 32x32 viewBox (renders well at all sizes) - Simple shapes only - High contrast between background and foreground - Brand colors integrated ### Step 2: Generate Multi-Size ICO **Using online converter** (recommended for simplicity): 1. Go to https://favicon.io or https://realfavicongenerator.net 2. Upload `favicon.svg` 3. Generate ICO with 16x16 and 32x32 sizes 4. Download as `favicon.ico` **Using ImageMagick** (if available): ```bash convert favicon.svg -define icon:auto-resize=16,32 favicon.ico ``` ### Step 3: Generate PNG Icons **Apple Touch Icon** (180x180, solid background): ```bash # Using ImageMagick convert favicon.svg -resize 180x180 -background "#0066cc" -alpha remove apple-touch-icon.png # Or manually in Figma/Illustrator: # 1. Create 180x180 artboard with solid background color # 2. Center icon at appropriate size (~120x120) # 3. Export as PNG ``` **Android/PWA Icons** (192x192 and 512x512): ```bash convert favicon.svg -resize 192x192 -background transparent icon-192.png convert favicon.svg -resize 512x512 -background transparent icon-512.png ``` **CRITICAL**: iOS icons MUST have solid backgrounds. Android/PWA icons can be transparent. ### Step 4: Create Web Manifest **Create `site.webmanifest`** (or `manifest.json`): ```json { "name": "Your Business Name", "short_name": "Business", "icons": [ { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" }, { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png" } ], "theme_color": "#0066cc", "background_color": "#ffffff", "display": "standalone" } ``` --- ## HTML Integration ### Complete Favicon HTML (Add to `
`): ```html ``` **Order matters**: SVG first (modern browsers), ICO second (fallback) **File locations**: All files should be in site root (`/public/` in Vite/React) --- ## Extraction Guidelines (Logo → Favicon) ### Identifying Extractable Icons **✅ Good candidates**: - Standalone symbol in logo (rocket, leaf, shield) - Lettermark that works alone ("A", "M", "ZW") - Geometric shape that represents brand - Icon that appears before/after text in logo **❌ Difficult candidates**: - Full text-only logos (need monogram instead) - Highly detailed illustrations (simplify first) - Horizontal lockups with no icon element ### Extraction Process 1. **Open logo SVG in editor** (VS Code, Figma, Illustrator) 2. **Identify the icon element** (paths, groups that form the symbol) 3. **Copy just those paths** (exclude text, taglines, background) 4. **Create new 32x32 SVG** with extracted paths 5. **Center and scale** the icon to fill ~80% of viewBox 6. **Simplify if needed** (remove fine lines, merge shapes) 7. **Test at 16x16** (zoom out, check legibility) ### Simplification Tips At 16x16 pixels, details disappear: - **Merge close shapes** (gaps < 2px become invisible) - **Remove thin lines** (< 2px width disappears) - **Increase stroke width** (minimum 2-3px) - **Reduce color count** (2-3 colors max) - **Increase contrast** (background vs foreground) **Example**: Detailed rocket → Simple triangle + circle + flame shapes --- ## Monogram Favicon Patterns ### Letter Selection Rules | Business Name | Monogram Options | Best Choice | |---------------|------------------|-------------| | Single word (Acme) | A, AC, AM | **A** (cleanest) | | Two words (Blue Sky) | B, BS, BSK | **BS** (both initials) | | Three words (Big Red Box) | B, BR, BRB | **BR** (drop last initial) | | Acronym (FBI, NASA) | FBI, NASA | **Use full acronym** | **Rule of thumb**: 1 letter > 2 letters > 3 letters (simpler is better at small sizes) ### Font and Size Guidelines **Font size by letter count**: - 1 letter: 18-20px (fills ~60% of 32px viewBox) - 2 letters: 14-16px (balance legibility and fit) - 3 letters: 11-13px (maximum, more = illegible) **Font family**: Use web-safe sans-serif fonts - `font-family="Arial, sans-serif"` (most reliable) - `font-family="Helvetica, sans-serif"` (clean) - `font-family="Verdana, sans-serif"` (readable at small sizes) **Font weight**: Always use `font-weight="bold"` or `font-weight="700"` (regular weight disappears at 16x16) ### Shape Templates Use templates in `templates/` directory: - **Circle** (`favicon-svg-circle.svg`) - Universal, safe choice - **Rounded Square** (`favicon-svg-square.svg`) - Modern, matches iOS - **Shield** (`favicon-svg-shield.svg`) - Security, protection industries - **Hexagon** (create from template) - Tech, engineering --- ## Industry-Specific Shape Recommendations ### By Industry | Industry | Recommended Shape | Color Palette | |----------|------------------|---------------| | **Technology** | Hexagon, Circle | Blue (#0066cc), Teal (#00a896) | | **Finance** | Square, Shield | Dark blue (#003366), Green (#00733b) | | **Healthcare** | Circle, Cross | Medical blue (#0077c8), Green (#00a651) | | **Real Estate** | House outline, Square | Earth tones (#8b4513), Blue (#4a90e2) | | **Security** | Shield, Lock | Dark blue (#1a237e), Red (#c62828) | | **Food/Restaurant** | Circle, Rounded square | Warm colors (Orange #ff6b35, Red #d62828) | | **Creative/Agency** | Abstract shapes | Bold colors (Purple #7209b7, Pink #f72585) | | **Legal** | Scales, Shield | Navy (#001f54), Gold (#c5a778) | | **Education** | Book, Circle | Blue (#1976d2), Green (#388e3c) | | **Retail** | Shopping bag, Tag | Brand-specific | **When in doubt**: Use a circle with brand colors (universally works) --- ## Color Guidelines ### Choosing Favicon Colors **Must match existing branding**: - Primary brand color for background - Contrasting color for foreground/text - 2-3 colors maximum (more = muddy at small sizes) **Contrast requirements**: - Minimum contrast ratio: 4.5:1 (WCAG AA) - Test at 16x16 to verify legibility - Light backgrounds → dark text - Dark backgrounds → light text **No transparency on iOS**: ```xml