Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48050814d3 |
@@ -76,14 +76,16 @@ node assets/brand/build-app-icons.mjs
|
||||
|
||||
The icons that ship are flat. Each platform masks and lights its own icons, so lit artwork ends up lit twice. `app-icons/` keeps a lit version of the two desktop icons, a baked approximation of macOS Liquid Glass. Nothing uses them.
|
||||
|
||||
The packaged Mac app takes its icon from `packages/desktop/assets/icon.icon`, an Icon Composer document the script also writes. macOS draws Liquid Glass on it and derives the dark, tinted, and clear variants. electron-builder compiles the document with `actool`, so packaging the Mac app needs Xcode 26 or later. The Nix build has no Xcode and uses `icon.icns`.
|
||||
The packaged Mac app (`packages/desktop/assets/icon.icon`) and the iOS app (`packages/app/assets/images/Paseo.icon`) take their icons from Icon Composer documents the script writes. Xcode's `actool` (26 or later) compiles them into live Liquid Glass layers plus dark, tinted, clear, and pre-26 fallback assets. The Nix desktop build has no Xcode and uses `icon.icns`, and `packages/app/assets/images/icon.png` remains as the opaque square Expo fallback.
|
||||
|
||||
To see what macOS draws from the document without packaging the app, export it with Icon Composer's command line tool on a Mac:
|
||||
Android uses separate `android-icon-foreground.png` and `android-icon-monochrome.png` layers sized to keep the butterfly inside the `66 dp` circular safe zone on a `108 dp` adaptive canvas, plus a full-bleed opaque `512 × 512` store icon at `fastlane/metadata/android/en-US/images/icon.png` for Google Play and F-Droid. The web manifest splits rounded `purpose: "any"` icons from full-bleed opaque `purpose: "maskable"` icons sized inside the central `80%` safe circle.
|
||||
|
||||
To see what Apple renders from either Icon Composer document without packaging the app, export it with Icon Composer's command line tool on a Mac:
|
||||
|
||||
```sh
|
||||
"/Applications/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool" \
|
||||
packages/desktop/assets/icon.icon --export-image --output-file icon.png \
|
||||
--platform macOS --rendition Default --width 1024 --height 1024 --scale 1
|
||||
packages/app/assets/images/Paseo.icon --export-image --output-file icon.png \
|
||||
--platform iOS --rendition Default --width 1024 --height 1024 --scale 1
|
||||
```
|
||||
|
||||
`--rendition` also takes `Dark`, `TintedLight`, `TintedDark`, `ClearLight`, and `ClearDark`.
|
||||
|
||||
@@ -38,13 +38,23 @@ const WINDOWS_LINUX_TILE_ON_CANVAS = 928 / CANVAS;
|
||||
const TILE = 700;
|
||||
const TILE_RADIUS = 185;
|
||||
const MARK_INK = 527;
|
||||
// Scaled down, the mark keeps clear of the tile's corners and covers as much of the tile as the
|
||||
// glyphs in Apple's icons do.
|
||||
const MARK_SCALE = 0.9;
|
||||
const MARK_INK_ON_TILE = (MARK_INK * MARK_SCALE) / TILE;
|
||||
// Desktop keeps extra breathing room on the macOS Dock tile (824/1024 canvas).
|
||||
const DESKTOP_MARK_SCALE = 0.9;
|
||||
const DESKTOP_MARK_INK_ON_TILE = (MARK_INK * DESKTOP_MARK_SCALE) / TILE;
|
||||
|
||||
// Android shows the middle 72 of an adaptive icon's 108 units.
|
||||
const ANDROID_ADAPTIVE_VISIBLE = 72 / 108;
|
||||
// iOS and full-bleed square tiles size the open single-stroke butterfly close to Apple's ~80%
|
||||
// safe-area keyline (~11% edge margin, matching neighboring icons on the Home Screen).
|
||||
const MOBILE_MARK_INK_ON_TILE = 0.78;
|
||||
const MOBILE_MARK_SCALE = (MOBILE_MARK_INK_ON_TILE * TILE) / MARK_INK;
|
||||
|
||||
// Android adaptive icons use a 108dp canvas with a 72dp visible viewport and a 66dp circular safe
|
||||
// zone. Because the butterfly's diagonal span is ~1.16x its bounding box, 56dp height fills 77.8%
|
||||
// of the 72dp visible area while keeping its 65dp circumscribed circle inside the 66dp safe zone.
|
||||
const ANDROID_ADAPTIVE_MARK_INK = 56 / 108;
|
||||
// W3C maskable PWA icons guarantee an inner safe circle of 80% diameter. At 68% bounding-box ink,
|
||||
// the butterfly's circumscribed circle is 79% of the canvas.
|
||||
const PWA_MASKABLE_MARK_INK_ON_TILE = 0.68;
|
||||
const PWA_MASKABLE_MARK_SCALE = (PWA_MASKABLE_MARK_INK_ON_TILE * TILE) / MARK_INK;
|
||||
const NOTIFICATION_MARK_INK = 0.75;
|
||||
|
||||
// Apple's continuous corner. Each pair is a distance back along the incoming edge and a distance
|
||||
@@ -251,13 +261,13 @@ function canvasSvg(boxOnCanvas, content) {
|
||||
|
||||
// The tile with the mark on it. A masked tile has the continuous corners cut into the artwork. A
|
||||
// square tile is for platforms that apply their own mask.
|
||||
function tileIconSvg({ artwork, finish, tileOnCanvas, corners }) {
|
||||
function tileIconSvg({ artwork, finish, tileOnCanvas, corners, markScale }) {
|
||||
const look = artwork[finish];
|
||||
const isLit = finish === "lit";
|
||||
const filtered = (id, content) => (isLit ? `<g filter="url(#${id})">${content}</g>` : content);
|
||||
const tile =
|
||||
corners === "continuous" ? `<g clip-path="url(#tile)">${look.surface}</g>` : look.surface;
|
||||
const mark = scaledAboutCentre(MARK_SCALE, brandMark(isLit ? "url(#markBody)" : "#FFFFFF"));
|
||||
const mark = scaledAboutCentre(markScale, brandMark(isLit ? "url(#markBody)" : "#FFFFFF"));
|
||||
return canvasSvg(
|
||||
tileOnCanvas,
|
||||
[
|
||||
@@ -361,10 +371,10 @@ async function encodeIcns(icon) {
|
||||
return Buffer.concat([header, body]);
|
||||
}
|
||||
|
||||
// The Icon Composer document macOS 26 and later build the app icon from. The canvas is the whole
|
||||
// tile: macOS adds the mask, the margin, and the lighting. The mark stays opaque so it reads as
|
||||
// solid white on the black tile.
|
||||
function iconComposerFiles() {
|
||||
// An Icon Composer document compiled by Xcode's actool (26 and later). The canvas is the whole
|
||||
// tile: the OS adds the mask, margin, Liquid Glass lighting, and dark/tinted/clear variants. The
|
||||
// mark stays opaque so it reads as solid white on the black tile.
|
||||
function iconComposerFiles({ inkOnTile, squares }) {
|
||||
const layer = "butterfly.svg";
|
||||
const document = {
|
||||
fill: { solid: "srgb:0.00000,0.00000,0.00000,1.00000" },
|
||||
@@ -375,11 +385,11 @@ function iconComposerFiles() {
|
||||
translucency: { enabled: false, value: 0.5 },
|
||||
},
|
||||
],
|
||||
"supported-platforms": { squares: ["macOS"] },
|
||||
"supported-platforms": { squares },
|
||||
};
|
||||
return [
|
||||
["icon.json", `${JSON.stringify(document, null, 2)}\n`],
|
||||
[`Assets/${layer}`, `${markOnlySvg(MARK_INK_ON_TILE)}\n`],
|
||||
[`Assets/${layer}`, `${markOnlySvg(inkOnTile)}\n`],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -390,7 +400,15 @@ function write(file, data) {
|
||||
}
|
||||
|
||||
function desktopIcon(artwork, finish, tileOnCanvas) {
|
||||
return rasterizer(tileIconSvg({ artwork, finish, tileOnCanvas, corners: "continuous" }));
|
||||
return rasterizer(
|
||||
tileIconSvg({
|
||||
artwork,
|
||||
finish,
|
||||
tileOnCanvas,
|
||||
corners: "continuous",
|
||||
markScale: DESKTOP_MARK_SCALE,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function buildDesktopIcons() {
|
||||
@@ -417,7 +435,10 @@ async function buildDesktopIcons() {
|
||||
`${assets}/icon.icns`,
|
||||
await encodeIcns(desktopIcon(PRODUCTION, "flat", MACOS_TILE_ON_CANVAS)),
|
||||
);
|
||||
for (const [file, content] of iconComposerFiles()) {
|
||||
for (const [file, content] of iconComposerFiles({
|
||||
inkOnTile: DESKTOP_MARK_INK_ON_TILE,
|
||||
squares: ["macOS"],
|
||||
})) {
|
||||
write(`${assets}/icon.icon/${file}`, content);
|
||||
}
|
||||
write(
|
||||
@@ -427,26 +448,45 @@ async function buildDesktopIcons() {
|
||||
}
|
||||
|
||||
async function buildMobileIcons() {
|
||||
const flat = (corners) =>
|
||||
rasterizer(tileIconSvg({ artwork: PRODUCTION, finish: "flat", tileOnCanvas: 1, corners }));
|
||||
// iOS masks these itself, and Expo flattens any transparency in the app icon onto white.
|
||||
const flat = (corners, markScale = MOBILE_MARK_SCALE) =>
|
||||
rasterizer(
|
||||
tileIconSvg({ artwork: PRODUCTION, finish: "flat", tileOnCanvas: 1, corners, markScale }),
|
||||
);
|
||||
// Full-bleed opaque square for platforms and stores that apply their own mask (iOS fallback,
|
||||
// Apple touch icon, Google Play / F-Droid store listing).
|
||||
const square = flat("square");
|
||||
// Shown as supplied, so the corners are part of the artwork.
|
||||
// Shown unmasked (splash screen and PWA `purpose: "any"` icons), so continuous corners belong
|
||||
// in the artwork.
|
||||
const masked = flat("continuous");
|
||||
const adaptiveForeground = rasterizer(markOnlySvg(ANDROID_ADAPTIVE_VISIBLE * MARK_INK_ON_TILE));
|
||||
// PWA `purpose: "maskable"` icons must be full-bleed opaque squares with artwork inside the
|
||||
// central 80% safe circle.
|
||||
const pwaMaskable = flat("square", PWA_MASKABLE_MARK_SCALE);
|
||||
const adaptiveForeground = rasterizer(markOnlySvg(ANDROID_ADAPTIVE_MARK_INK));
|
||||
const notification = rasterizer(markOnlySvg(NOTIFICATION_MARK_INK));
|
||||
|
||||
for (const [file, content] of iconComposerFiles({
|
||||
inkOnTile: MOBILE_MARK_INK_ON_TILE,
|
||||
squares: "shared",
|
||||
})) {
|
||||
write(`packages/app/assets/images/Paseo.icon/${file}`, content);
|
||||
}
|
||||
write("packages/app/assets/images/icon.png", await square.opaquePng(1024));
|
||||
write("packages/app/public/apple-touch-icon.png", await square.opaquePng(180));
|
||||
write(
|
||||
"packages/app/assets/images/android-icon-foreground.png",
|
||||
await adaptiveForeground.png(1024),
|
||||
);
|
||||
write(
|
||||
"packages/app/assets/images/android-icon-monochrome.png",
|
||||
await adaptiveForeground.png(1024),
|
||||
);
|
||||
write("packages/app/assets/images/notification-icon.png", await notification.png(96));
|
||||
write("packages/app/assets/images/splash-icon.png", await masked.png(1024));
|
||||
write("packages/app/public/pwa-icon-192.png", await masked.png(192));
|
||||
write("packages/app/public/pwa-icon-512.png", await masked.png(512));
|
||||
write("fastlane/metadata/android/en-US/images/icon.png", await masked.png(512));
|
||||
write("packages/app/public/pwa-icon-maskable-192.png", await pwaMaskable.opaquePng(192));
|
||||
write("packages/app/public/pwa-icon-maskable-512.png", await pwaMaskable.opaquePng(512));
|
||||
write("fastlane/metadata/android/en-US/images/icon.png", await square.opaquePng(512));
|
||||
}
|
||||
|
||||
async function buildLitIcons() {
|
||||
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 15 KiB |
@@ -111,6 +111,7 @@ export default {
|
||||
userInterfaceStyle: "automatic",
|
||||
newArchEnabled: true,
|
||||
ios: {
|
||||
icon: "./assets/images/Paseo.icon",
|
||||
supportsTablet: true,
|
||||
infoPlist: {
|
||||
NSMicrophoneUsageDescription: "This app needs access to the microphone for voice commands.",
|
||||
@@ -126,6 +127,7 @@ export default {
|
||||
adaptiveIcon: {
|
||||
backgroundColor: "#000000",
|
||||
foregroundImage: "./assets/images/android-icon-foreground.png",
|
||||
monochromeImage: "./assets/images/android-icon-monochrome.png",
|
||||
},
|
||||
edgeToEdgeEnabled: true,
|
||||
predictiveBackGestureEnabled: false,
|
||||
|
||||
@@ -230,3 +230,52 @@ describe("Android Bold text opt-out", () => {
|
||||
expect(exp.plugins).toContain("withAndroidIgnoreBoldText");
|
||||
}, 30_000);
|
||||
});
|
||||
|
||||
describe("app icons", () => {
|
||||
it("configures an iOS Icon Composer bundle alongside the opaque fallback icon", async () => {
|
||||
const { existsSync, readFileSync } = await import("node:fs");
|
||||
const { resolve } = await import("node:path");
|
||||
const { exp } = await getPrebuildConfigAsync(__dirname, { platforms: ["ios"] });
|
||||
expect(exp.ios?.icon).toBe("./assets/images/Paseo.icon");
|
||||
expect(exp.icon).toBe("./assets/images/icon.png");
|
||||
|
||||
const bundleDir = resolve(__dirname, exp.ios?.icon as string);
|
||||
const iconJson = JSON.parse(readFileSync(resolve(bundleDir, "icon.json"), "utf8"));
|
||||
const layer = iconJson.groups?.[0]?.layers?.[0]?.["image-name"];
|
||||
expect(layer).toBe("butterfly.svg");
|
||||
expect(existsSync(resolve(bundleDir, "Assets", layer))).toBe(true);
|
||||
expect(existsSync(resolve(__dirname, exp.icon as string))).toBe(true);
|
||||
}, 30_000);
|
||||
|
||||
it("configures Android adaptive foreground and monochrome layers", async () => {
|
||||
const { existsSync } = await import("node:fs");
|
||||
const { resolve } = await import("node:path");
|
||||
const { getAdaptiveIcon, createAdaptiveIconXmlString } = requireFromExpoCli(
|
||||
"@expo/prebuild-config/build/plugins/icons/withAndroidIcons.js",
|
||||
);
|
||||
const { exp } = await getPrebuildConfigAsync(__dirname, { platforms: ["android"] });
|
||||
const adaptive = getAdaptiveIcon(exp);
|
||||
expect(adaptive.backgroundColor).toBe("#000000");
|
||||
expect(adaptive.foregroundImage).toBe("./assets/images/android-icon-foreground.png");
|
||||
expect(adaptive.monochromeImage).toBe("./assets/images/android-icon-monochrome.png");
|
||||
expect(existsSync(resolve(__dirname, adaptive.foregroundImage))).toBe(true);
|
||||
expect(existsSync(resolve(__dirname, adaptive.monochromeImage))).toBe(true);
|
||||
|
||||
const xml = createAdaptiveIconXmlString(adaptive.backgroundImage, adaptive.monochromeImage);
|
||||
expect(xml).toContain('<foreground android:drawable="@mipmap/ic_launcher_foreground"/>');
|
||||
expect(xml).toContain('<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>');
|
||||
}, 30_000);
|
||||
|
||||
it("declares separate any and maskable PWA icons that exist on disk", async () => {
|
||||
const { existsSync, readFileSync } = await import("node:fs");
|
||||
const { resolve } = await import("node:path");
|
||||
const manifest = JSON.parse(readFileSync(resolve(__dirname, "public/manifest.json"), "utf8"));
|
||||
const purposes = manifest.icons.map((icon: { purpose: string }) => icon.purpose);
|
||||
expect(purposes).toContain("any");
|
||||
expect(purposes).toContain("maskable");
|
||||
expect(purposes).not.toContain("any maskable");
|
||||
for (const icon of manifest.icons) {
|
||||
expect(existsSync(resolve(__dirname, "public", icon.src.replace(/^\//, "")))).toBe(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
After Width: | Height: | Size: 5.9 KiB |
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"fill": {
|
||||
"solid": "srgb:0.00000,0.00000,0.00000,1.00000"
|
||||
},
|
||||
"groups": [
|
||||
{
|
||||
"layers": [
|
||||
{
|
||||
"image-name": "butterfly.svg",
|
||||
"name": "butterfly"
|
||||
}
|
||||
],
|
||||
"shadow": {
|
||||
"kind": "neutral",
|
||||
"opacity": 0.5
|
||||
},
|
||||
"translucency": {
|
||||
"enabled": false,
|
||||
"value": 0.5
|
||||
}
|
||||
}
|
||||
],
|
||||
"supported-platforms": {
|
||||
"squares": "shared"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.5 KiB |
@@ -15,13 +15,25 @@
|
||||
"src": "/pwa-icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/pwa-icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
"purpose": "any"
|
||||
},
|
||||
{
|
||||
"src": "/pwa-icon-maskable-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/pwa-icon-maskable-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 14 KiB |