Fixing white borders on Apple touch icons
How transparent PNGs cause white borders on Apple devices and the fix.
Transparent PNGs get white borders on Apple devices. Here’s the fix.
The Problem
Apple devices fill transparent areas in apple-touch-icon.png with white. The existing favicon.svg had a dark rounded rect background, but when converted to PNG, the corners outside the rounded rect were transparent. Apple replaced those transparent pixels with white, creating a visible border.
![]()
What Changed
I created an opaque version of the icon, full square, no rounded corners, solid #282828 background, using rsvg-convert:
rsvg-convert -w 180 -h 180 apple-touch-icon.svg -o apple-touch-icon.png
The source SVG was identical to favicon.svg but with a square background instead of rounded:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<rect width="100" height="100" fill="#282828" />
<!-- icon paths unchanged -->
</svg>
I added two tags to BaseLayout.astro:
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/site.webmanifest" />
And created site.webmanifest with explicit background color:
{
"name": "Fran Gonzalez",
"short_name": "Fran",
"icons": [
{
"src": "/apple-touch-icon.png",
"sizes": "180x180",
"type": "image/png"
}
],
"theme_color": "#282828",
"background_color": "#282828",
"display": "standalone"
}
The apple-touch-icon tag is deprecated; the manifest is the modern approach. Including both covers older devices.
References
- Apple Touch icon for websites: Stack Overflow. Confirmed single 180x180 icon is sufficient
- MDN: icons: Web app manifest. Manifest icon spec and
purposevalues - librsvg/rsvg-convert. SVG to PNG conversion tool
This post was written with AI assistance.