trilium/scripts/icons
Elian Doran 9f2d87a0df
fix(desktop): macOS app icon renders as noise at small sizes (closes #11187)
`icnsutil compose` picks a chunk's OSType from the image size, so the 16px and
32px slots were stored as `icp4`/`icp5`. macOS IconServices decodes those as raw
pixel data rather than PNG, so every consumer that lands on a small
representation drew colored noise -- Raycast's result list, Finder at 16pt, and
Apple's own `iconutil -c iconset`. Spotlight draws the icon large enough to miss
it.

icnsutil also takes the OSType from the file name, so the intermediates are now
named by OSType instead of by size. That drops `icp4`/`icp5` and fills in the
slots the size-driven loop never produced: `ic08` (256) and the retina
`ic11`/`ic12`/`ic13`. Default and nightly get separate scratch directories --
they used to share `mac/` and be told apart by a `*-dev.png` glob, which cannot
survive OSType names.

The slot table avoids `declare -A`: macOS ships bash 3.2, and this is the
section a Mac user is most likely to re-run.

Also replaces `rm -r mac/*` with `rm -rf mac`. `app-icon/mac` is gitignored, so
on a fresh clone that line aborted the whole script under `set -e`.

Verified by building two throwaway `.app` bundles differing only in their icns
and drawing both through `NSWorkspace.icon(forFile:)`: before, 32pt is noise and
16pt is a cyan wash; after, both render the logo. `iconutil -c iconset` decodes
every slot of the regenerated files.

No 16pt slot is shipped. Its modern type, `ic04`, requires raw ARGB -- a PNG
payload under `ic04` is mis-decoded exactly like `icp4` -- and icnsutil needs
Pillow to produce ARGB. macOS synthesizes 16pt from `ic11` instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 12:26:15 +03:00
..
tray chore(regroup): relocate icon scripts 2025-12-06 10:07:23 +02:00
create-icons.sh fix(desktop): macOS app icon renders as noise at small sizes (closes #11187) 2026-08-25 12:26:15 +03:00