Skip to content

fix(desktop): build macOS icns with sips + iconutil - #596

Draft
liukewia wants to merge 1 commit into
TencentCloud:developfrom
liukewia:fix/desktop-icns-sips-iconutil
Draft

fix(desktop): build macOS icns with sips + iconutil#596
liukewia wants to merge 1 commit into
TencentCloud:developfrom
liukewia:fix/desktop-icns-sips-iconutil

Conversation

@liukewia

@liukewia liukewia commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Dock/Finder icon has visible dark specks at 64, 128 and 256 px.

wails3 generate icons encodes the .icns through jackmordaunt/icns, which
resizes with Mitchell-Netravali. Its negative lobe overshoots on the logo's
high-contrast edges (white glyph on red, squircle on transparent): the R channel
clips at 0 while G/B keep mid values, producing near-opaque teal-black pixels
such as (1, 51, 54, 254) scattered across the red tile.

Measured against the source image's opaque RGB gamut:

layer wails3 sips + iconutil
64px 4 dark px 0
128px 13 dark px 0
256px 23 dark px 0

That encoder also emits only 8 layers. Its smallest osType is 32px (ic11),
which icns treats as icon_16x16@2x — so icon_16x16 and icon_32x32 are
absent and Finder downscales a larger layer for small sizes.

Change

Build the .iconset with sips -z and pack it with iconutil. All 10 layers
are present, and Core Graphics downsampling leaves no overshoot.

generate:icons is split because sips/iconutil are macOS-only: the shared
task still emits the Windows .ico on every platform, and the new
generate:icons:darwin owns the .icns. The darwin build depends on the latter
(it never needed the Windows .ico).

Verification

wails3 task common:generate:icons:darwin   # 10 layers, sizes verified via iconutil -c iconset
wails3 task common:generate:icons          # windows/icon.ico still produced

Not covered: the source appicon-macos.png carries black RGB in its
semi-transparent edge (4138 px at alpha 6-9, RGB ~(39,30,30)) — non-premultiplied
export without edge extend. It tints the 256px edge band but stays under
alpha 120, so it is not the speck problem above and would need a fix in the
design source, not the packaging script.

wails3's encoder resizes with Mitchell-Netravali, whose negative lobe
overshoots on the logo's high-contrast edges. The R channel clips at 0
while G/B keep mid values, leaving near-opaque dark pixels scattered over
the red tile: 4 in the 64px layer, 13 at 128px, 23 at 256px. It also
emits only 8 layers, missing icon_16x16 and icon_32x32, so Finder has to
downscale a larger layer for small sizes.

Generate the .iconset with sips and pack it with iconutil instead. All 10
layers are present and Core Graphics downsampling leaves no overshoot.

generate:icons is split because sips and iconutil are macOS-only: the
shared task keeps emitting the Windows .ico on every platform, while the
new darwin-only task owns the .icns.

Co-authored-by: Cursor <cursoragent@cursor.com>
@liukewia
liukewia marked this pull request as draft September 7, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant