01 · failure
Full card + alpha
The opaque card survives as one large shape. Colour detail disappears.
macOS menu bar · source-bound reference
A macOS template image throws colour away and keeps alpha. Feed it an opaque app-icon card and the card becomes the shape: a black block. The reliable fix is a separate, transparent tray.svg designed to survive at 16 pixels.
The failure, reproduced
Template images are black plus transparency. macOS supplies the visible colour for the current appearance; the source alpha supplies the silhouette. That is why this failure looks mysterious in a colour editor and obvious once the alpha channel is treated as the drawing.
01 · failure
alphaThe opaque card survives as one large shape. Colour detail disappears.
02 · recovery
autoauto detects card-like coverage and derives alpha from edge contrast.
03 · preferred
tray.svg + autoA sparse source keeps intentional transparency and a legible silhouette.
These are not illustrative redraws. The five PNGs on this page are rebuilt from brand/build by iconflow.assemble.to_template; CI compares every byte.
Use one sparse mark with real transparency around it. At 16 pixels, enclosed holes and separated strokes matter more than colour.
Ship black plus alpha, then inspect the same mask on light and dark menu bars. Do not bake a light-mode or dark-mode colour into the source.
Electron recognizes the template convention from filenames: trayTemplate.png and trayTemplate@2x.png.
Accessibility is separate. Keep a real title or label on the menu-bar control. SwiftUI uses the MenuBarExtra title for accessibility even when the visible control is an image.
The colour pair is useful on platforms that accept it. The Template pair is the macOS contract: 16 pixels at standard density and 32 pixels for retina. The optional TypeScript module embeds the same source bytes for Electron projects that prefer an inline asset.
| File | Size | Why it exists |
|---|---|---|
tray/tray.png | 32 × 32 px | Colour tray icon at 2× density. |
tray/tray@16.png | 16 × 16 px | Colour tray icon at 1× density. |
tray/trayTemplate.png | 16 × 16 px | macOS template: pure black plus alpha. The system recolours it. |
tray/trayTemplate@2x.png | 32 × 32 px | Retina template pair. Required, not optional. |
tray/trayIcon.ts | TypeScript | Optional inline data-URL module (--tray-ts). |
The table is read from the same preview_assets path as a real build. If a filename or size changes, this generator cannot silently keep the old answer.
A separate source does not guarantee a useful template. Interior colour structure can still collapse into one featureless alpha shape. IconFlow renders the linked tray source through the selected conversion mode and reports when none of its meaningful interior features survive.
iconflow check master.svg \
--tray-svg tray.svg \
--tray-template-mode auto
iconflow review --config iconflow.toml --html review.html
iconflow ship --config iconflow.toml --review master-review.json
check is the early diagnostic. The final ship still re-runs automated QA and requires a current, source-hash-bound review receipt with every human score at least 4 out of 5.
autoalphacontrastThis guide binds IconFlow behaviour to the platform contracts rather than repeating folklore.
A macOS template image discards colour and uses the source alpha as its shape. If the source is an opaque app-icon card, that alpha says the entire card is the icon, so the system tints a solid block. Use a sparse, transparent tray drawing instead.
It is a black-and-transparent image that macOS recolours for the current menu-bar appearance. Black supplies the shape, transparency removes the background, and intermediate alpha supplies opacity.
Electron recommends a 16 by 16 pixel Template image at standard density and a matching 32 by 32 pixel retina file. IconFlow writes trayTemplate.png and trayTemplate@2x.png, plus colour equivalents.
For Electron's automatic macOS template handling, yes. The base file name must end in Template and the retina pair must keep the same base name before @2x. IconFlow emits those names exactly.
Usually not. App icons are cards designed for large launch surfaces; menu-bar icons are tiny, transparent silhouettes. IconFlow can derive a contrast mask from an opaque card as a fallback, but a simplified tray.svg is more legible and preserves intent.
Alpha preserves the source alpha, which is correct for a genuinely transparent tray mark. Contrast derives transparency from the difference between the mark and its background. Auto keeps alpha for a sparse source and switches to contrast for a full-card source.
Inspect the actual 16 pixel template in both contexts. The system tints the same alpha mask dark on a light bar and light on a dark bar; do not maintain separate coloured artwork for the two appearances.
No. A graphic is not an accessible name. Give the menu-bar control a real title or label; SwiftUI's MenuBarExtra title is used for accessibility even when the visible control uses an image.
One source for each job.
Keep the visual relationship, change the geometry for the surface, and let the same review receipt prove both sources.