Create Favicons
Favicons are the small icons that appear in browser tabs, bookmarks, and address bars. Providing favicons that look great across all devices, browsers, and operating systems is traditionally complex and time-consuming.
Why Favicons Matter
Brand Recognition:
Instant visual identification in crowded browser tabs
Professional appearance in bookmark lists
Consistent branding across all platforms
User Experience:
Easier navigation when multiple tabs are open
Quick identification in browser history
Better mobile home screen appearance
Platform Requirements:
Each browser and OS expects different sizes
Multiple formats needed (ICO, PNG, SVG)
Special icons for touch devices and pinned tabs
Favicons are separate from app icons declared in the Web App Manifest, though they serve similar purposes. The bundle automatically generates both from a single source image.
Quick Setup
With this bundle, generating all necessary favicons takes just seconds. You only need one source file:
Requirements:
Square icon (recommended)
SVG format (preferred) or PNG (512x512px minimum)
Transparent background (highly recommended)
Basic configuration:
That's it! The bundle automatically generates all required favicon sizes and formats for:
Desktop browsers (16x16, 32x32, 48x48)
Touch devices (180x180 for Apple, 192x192 for Android)
Windows tiles (70x70 to 310x310)
Safari pinned tabs
And more...
Icon Source Options
The bundle supports three types of icon sources, giving you flexibility in how you provide your favicon:
1. Asset Mapper Asset (Recommended)
Reference icons managed by Symfony's Asset Mapper:
Advantages:
Version control friendly
Automatic cache busting
Works with build pipeline
2. Absolute File Path
Use an existing file from your project directory:
Use cases:
Files outside the assets directory
Dynamic file locations
Legacy icon files
3. Symfony UX Icons
Use any icon from the Symfony UX Icons library:
Advantages:
No file needed
Access to thousands of icons
Consistent icon library
Popular icon sets:
heroicons:- Heroiconsfa:- Font Awesomebx:- BoxIconslucide:- Lucide Icons
Customization Options
SVG Attributes
You can customize any SVG attribute directly to control how your icon is rendered. The bundle allows you to modify fill colors, stroke properties, and any other SVG root attributes:
Common SVG attributes you can modify:
fill: Main fill color of the iconstroke: Outline/border colorstroke-width: Width of the strokeopacity: Overall transparencycolor: Used when SVG usescurrentColor
Icon Scaling and Safe Zone
Different platforms apply masks to icons (circular, rounded square, etc.). To ensure your icon looks good on all platforms, use the safe zone feature.
The problem: Some platforms (especially Android) may crop icons to specific shapes.
The solution: Scale down your icon to stay within the safe zone:
Recommendations:
Use
image_scale: 80(80%) for icons with text or detailed graphicsUse
image_scale: 100for simple, centered logosTest on different Android devices to verify appearance
The bundle automatically adds transparent padding to maintain the original canvas size while scaling the icon content.
Background Color and Rounded Corners
Create polished, platform-native looking icons by adding backgrounds and rounded corners:
Parameters:
background_color: Hex color code (e.g.,#fffffffor white)border_radius: Percentage of icon size (0-50)0: Square corners10: Slightly rounded (modern look)25: Very rounded50: Perfect circle
The border_radius option only works when background_color is set. Without a background, corners remain transparent.
Dark Mode Icons
Support dark themes with dedicated dark mode icons. Modern devices automatically switch between light and dark icons based on system theme:
How it works:
default: Light theme icon (used when system is in light mode)dark: Dark theme icon (used when system is in dark mode)Browser automatically switches based on user's system theme preference
When dark is defined, default becomes the light mode variant. Without dark, default is used for both themes.
Platform-Specific Features
Safari Pinned Tab Icon
Safari's pinned tabs use a special monochrome icon. Configure it with a single color:
Silhouette mode:
Generates a single-color silhouette of your icon, perfect for Safari's minimalist pinned tab design.
Silhouette mode requires potrace to be installed on your system. Install it via your package manager (e.g., apt install potrace on Debian/Ubuntu).
Windows Tiles
Enable special tiles for Windows 8/10 Start Menu and taskbar:
What gets generated:
Small tile (70x70)
Medium tile (150x150)
Wide tile (310x150)
Large tile (310x310)
Windows tiles ignore background_color and border_radius options. The tile color is applied as a flat background by Windows itself.
Legacy Browser Support
Low Resolution Icons
By default, the bundle generates icons optimized for modern devices. Enable additional icon sizes for legacy browsers and older devices:
Additional sizes generated:
16x16 (very old browsers)
24x24 (Windows XP)
32x32 (standard favicon)
64x64 (high-DPI favicon)
96x96 (Google TV)
128x128 (Chrome Web Store)
Enabling low_resolution increases compilation time and generates more files. Only enable if you need legacy browser support.
Complete Configuration Example
Deprecated options: The following flat options are deprecated since 1.3.0 and will be removed in 2.0:
src→ usedefault.srcsrc_dark→ usedark.srcbackground_color→ usedefault.background_colorbackground_color_dark→ usedark.background_colorborder_radius→ usedefault.border_radiusand/ordark.border_radiusimage_scale→ usedefault.image_scaleand/ordark.image_scale
Migrate to the default and dark structure for full control and future compatibility.
What Gets Generated
When you compile favicons, the bundle creates:
Standard favicons:
favicon.ico(multi-size ICO file)favicon.svg(for modern browsers)apple-touch-icon.png(180x180 for iOS)icon-192.png,icon-512.png(for Android)
HTML tags injected by {{ pwa() }}:
All files are automatically optimized and cached for production.
Best Practices
Use SVG when possible: Scales perfectly to all sizes without quality loss
Transparent backgrounds: Works on any platform background color
Simple designs: Complex details may not be visible at small sizes (16x16)
Test safe zone: Ensure important elements stay within 80% of icon area
Dark mode support: Provide dark icons for better user experience
Skip legacy support: Unless you have specific requirements, modern icons are sufficient
Troubleshooting
Icons not appearing
Check:
Icon file exists at specified path
File format is supported (SVG, PNG)
Compilation ran successfully (
php bin/console pwa:compile)HTML includes
{{ pwa() }}function
Silhouette not generating
Requirements:
potracemust be installedIcon must have clear shapes (not gradients)
Use
potraceparameter if in custom location
Dark icons not switching
Verify:
Device/browser supports dark mode
Both
defaultanddarksections are configuredIcons have been recompiled
System theme is actually changing (test in browser DevTools)
Last updated
Was this helpful?