Repository navigation
Description
What
Let people pick the J5 Code app icon from a set of paper boats. Scope is desktop and web. Mobile is tracked separately in #410 until the mobile client catches up.
Every choice uses the production background (the marketing site hero's navy, assets/prod/app-icon.icon/Assets/background.svg) with a different boat from the site (apps/marketing/src/components/BoatSprite.astro, PersonaScene.astro):
| Choice | Boat |
|---|---|
| Captain (default) | Captain's sloop: brass star, stripe and pennant. Ships as the production icon. |
| Sloop | The plain fleet boat with a green pennant |
| Speedboat | Raised bow, raked windshield, wake. Ships as dev's boat, on the blueprint. |
| Searchlight | The Reviewer's sloop with a bow searchlight. Ships as nightly's boat, under the night sky. |
| Lookout | The Researcher's skiff with a crow's nest |
| Lanterns | The Designer's skiff with a string of lights |
| Crane | The Builder's freighter with a bow crane |
| Anchor | The Tester's freighter with an anchor and life ring |
How it would work
- Desktop: the main process already swaps the Dock icon at runtime (
apps/desktop/src/electron/ElectronApp.ts,app.dock.setIcon). The picker sets that and the window icons (Windows/Linux) from a setting, over a small IPC call. The choices have to be bundled as app resources, which touchesscripts/build-desktop-artifact.ts(upstream; FORK.md case). - Web: swap the favicon links at runtime.
- Settings: needs a J5 seam in upstream's Settings screen (FORK.md case).
- Feature definition: add one under
docs/j5/product/.
Known limitation
On macOS, a runtime icon only shows while the app runs. When it's closed, Finder, Launchpad, the Dock and notifications show the bundled icon (Captain). Rewriting the bundle's icon would break the code signature.
Art
Each choice is a copy of assets/prod/app-icon.icon with Assets/text.svg replaced by that boat's layer. The generator below writes every boat's layer: plain <path> elements in the 128pt box, fitted around 64,64 inside the 90×75pt box the Android script uses. Captain, speedboat and searchlight are already in the repo as the three channels' text.svg. Export with vp run icons:export; the macOS PNGs use the inset described in BRANDING.md (App icons).
Boat layer generator (node --input-type=module; boatSvg(name))
// J5 boats from apps/marketing/src/components/{BoatSprite,PersonaScene}.astro, flattened into
// absolute <path> elements in the 128pt Icon Composer box, fitted and centered on 64,64.
const INK = "#DFE9EE", PAPER = "#F4EFE4", SHADE = "#CFD9DF", BRASS = "#C9A24D", NAVY_INK = "#12202F", PENNANT = "#6FCF9A";
const f = (n) => String(+n.toFixed(2));
// Minimal SVG path transformer for uniform scale + translate (M L H V Q C Z, absolute and relative).
function tpath(d, s, tx, ty) {
const out = []; const re = /([MLHVQCZmlhvqcz])([^MLHVQCZmlhvqcz]*)/g; let m;
while ((m = re.exec(d))) {
const c = m[1], nums = (m[2].match(/-?\d*\.?\d+(?:e-?\d+)?/g) || []).map(Number), up = c.toUpperCase(), rel = c !== up;
let mapped;
if (up === "Z") mapped = [];
else if (up === "H") mapped = nums.map((n) => (rel ? n * s : n * s + tx));
else if (up === "V") mapped = nums.map((n) => (rel ? n * s : n * s + ty));
else mapped = nums.map((n, i) => (rel ? n * s : n * s + (i % 2 ? ty : tx)));
out.push(c + mapped.map(f).join(" "));
}
return out.join("");
}
const polyD = (pts) => "M" + pts.trim().split(/\s+/).map((p) => p.replace(",", " ")).join("L") + "Z";
const rectD = (x, y, w, h) => `M${x} ${y}h${w}v${h}h${-w}Z`;
const circleD = (cx, cy, r) => ({ circle: [cx, cy, r] });
// Each part: [d | {circle}, attrs]. Attrs use sprite units; stroke widths get scaled.
const sail = (apex) => [
[polyD(`14,30 32,${apex} 32,30`), { fill: SHADE, stroke: INK, sw: 1.6 }],
[polyD(`32,${apex} 32,30 50,30`), { fill: PAPER, stroke: INK, sw: 1.6 }],
];
const sloop = [
...sail(8),
[polyD("4,30 60,30 50,44 14,44"), { fill: PAPER, stroke: INK, sw: 1.6 }],
["M8 35h48", { stroke: NAVY_INK, so: 0.25, sw: 1 }],
[circleD(24, 37, 1.4), { fill: NAVY_INK }], [circleD(40, 37, 1.4), { fill: NAVY_INK }],
["M32 8v-7", { stroke: INK, sw: 1.4 }],
[polyD("32,0 45,3.5 32,7"), { fill: PENNANT }],
];
const skiff = [
[polyD("6,34 58,34 50,44 14,44"), { fill: PAPER, stroke: INK, sw: 1.6 }],
[polyD("28,26 44,26 48,34 24,34"), { fill: SHADE, stroke: INK, sw: 1.6 }],
["M8 39h44", { stroke: NAVY_INK, so: 0.25, sw: 1 }],
[circleD(24, 39.5, 1.3), { fill: NAVY_INK }], [circleD(40, 39.5, 1.3), { fill: NAVY_INK }],
];
const freighter = [
[polyD("0,30 64,30 58,46 6,46"), { fill: PAPER, stroke: INK, sw: 1.6 }],
[rectD(44, 16, 12, 14), { fill: PAPER, stroke: INK, sw: 1.6 }],
[rectD(46.5, 19, 3, 3), { fill: "#102A47" }], [rectD(51, 19, 3, 3), { fill: "#102A47" }],
[rectD(58, 21, 4, 9), { fill: PAPER, stroke: INK, sw: 1.6 }],
["M4 38h56", { stroke: NAVY_INK, so: 0.25, sw: 1 }],
[circleD(22, 39, 1.4), { fill: NAVY_INK }], [circleD(40, 39, 1.4), { fill: NAVY_INK }],
["M50 16v-9", { stroke: INK, sw: 1.4 }],
[polyD("50,6 62,9 50,12"), { fill: PENNANT }],
];
const line = (d, sw = 1.4, extra = {}) => [d, { stroke: INK, sw, cap: true, ...extra }];
export const BOATS = {
captain: { label: "Captain", bounds: [2, -4, 62, 46], parts: [
...sail(4),
[polyD("2,30 62,30 51,46 13,46"), { fill: PAPER, stroke: INK, sw: 1.6 }],
[polyD("4,33 60,33 58.6,35.5 5.4,35.5"), { fill: BRASS }],
["M9 40h46", { stroke: NAVY_INK, so: 0.25, sw: 1 }],
[circleD(24, 40.5, 1.5), { fill: NAVY_INK }], [circleD(40, 40.5, 1.5), { fill: NAVY_INK }],
[polyD("32,19 33.6,22.3 37.2,22.8 34.6,25.3 35.2,28.9 32,27.2 28.8,28.9 29.4,25.3 26.8,22.8 30.4,22.3"), { fill: BRASS }],
["M32 4v-7", { stroke: INK, sw: 1.4 }],
[polyD("32,-4 46,-1.5 41,1 46,3.5 32,3"), { fill: BRASS }],
] },
sloop: { label: "Sloop", bounds: [4, 0, 60, 44], parts: sloop },
speedboat: { label: "Speedboat", bounds: [0, 16, 62, 44], parts: [
line("M60 34h12M61 38.5h9M60 43h7", 1.2, { so: 0.7 }),
[polyD("0,26 62,31 60,44 12,44"), { fill: PAPER, stroke: INK, sw: 1.6 }],
[polyD("20,27.6 29,17 44,17 46,29.2"), { fill: SHADE, stroke: INK, sw: 1.6 }],
[polyD("23,27.8 30,20 34,20 32,28.2"), { fill: "#9FB7C6" }],
["M6 33.5L60 37", { stroke: NAVY_INK, so: 0.25, sw: 1 }],
[circleD(26, 39, 1.4), { fill: NAVY_INK }], [circleD(42, 40, 1.4), { fill: NAVY_INK }],
line("M44 17v-6", 1.4),
[polyD("44,6 55,8.5 44,11"), { fill: PENNANT }],
] },
searchlight: { label: "Searchlight", bounds: [-12, 0, 60, 44], parts: [
[polyD("9,20 -12,6 -12,34"), { fill: "#FFF1C2", fo: 0.16 }],
[polyD("9,20 -12,10 -12,30"), { fill: "#FFF1C2", fo: 0.22 }],
[polyD("9,20 -6,15.5 -6,24.5"), { fill: "#FFF6DA", fo: 0.35 }],
...sloop,
line("M12 30v-8"),
[`M10 17h4a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1 -1.5 1.5h-4a1.5 1.5 0 0 1 -1.5 -1.5v-3a1.5 1.5 0 0 1 1.5 -1.5Z`, { fill: BRASS, stroke: NAVY_INK, sw: 1.4 }],
["M8.5 18.5v3", { stroke: "#FBF7EE", sw: 1.4 }],
] },
lookout: { label: "Lookout", bounds: [6, -1, 58, 44], parts: [
...skiff,
line("M36 26V0"),
[polyD("31,13 41,13 39.5,18 32.5,18"), { fill: SHADE, stroke: INK, sw: 1.6 }],
[polyD("36,-1 48,2.5 36,6"), { fill: PENNANT }],
] },
lantern: { label: "Lanterns", bounds: [6, 11, 58, 44], parts: [
...skiff,
line("M40 26V12"),
[polyD("40,11 52,14 40,17"), { fill: PENNANT }],
["M40 17Q50 30 58 33", { stroke: INK, sw: 1 }],
[circleD(44.2, 21.6, 1.7), { fill: "#E08A3C" }], [circleD(48.4, 26.6, 1.7), { fill: "#3B8FAE" }],
[circleD(52.8, 30.2, 1.7), { fill: PENNANT }], [circleD(56.6, 32.6, 1.7), { fill: BRASS }],
] },
crane: { label: "Crane", bounds: [0, 4, 64, 46], parts: [
...freighter,
[rectD(7, 26, 7, 4), { fill: SHADE, stroke: INK, sw: 1.6 }],
line("M10.5 26V8", 2.2), line("M10.5 10L30 4", 1.8), line("M10.5 16L22 6.5", 1, { so: 0.6 }),
line("M30 4v9", 1), line("M28 13q2 3 4 0", 1),
[rectD(25, 16, 10, 7), { fill: SHADE, stroke: INK, sw: 1.6 }],
] },
anchor: { label: "Anchor", bounds: [0, 6, 64, 46], parts: [
...freighter,
line("M10 30v6", 1, { dash: "1.5 1.5" }),
[circleD(10, 36.6, 1.2), { stroke: NAVY_INK, sw: 0.9 }],
["M10 37.8v5.6M7.6 39.3h4.8", { stroke: NAVY_INK, sw: 1, cap: true }],
["M6.8 41.2q3.2 3.6 6.4 0", { stroke: NAVY_INK, sw: 1, cap: true }],
[circleD(50, 38, 3.6), { fill: "#FBF7EE", stroke: "#C8442D", sw: 2.2 }],
["M46.4 38h7.2M50 34.4v7.2", { stroke: "#FBF7EE", sw: 1 }],
] },
};
export function fit(boat) {
const [x0, y0, x1, y1] = boat.bounds, w = x1 - x0, h = y1 - y0;
const s = Math.min(1.45, 90 / w, 75 / h);
return { s, tx: 64 - ((x0 + x1) / 2) * s, ty: 64 - ((y0 + y1) / 2) * s, box: { x: 64 - (w * s) / 2, y: 64 - (h * s) / 2, width: w * s, height: h * s } };
}
export function boatSvg(name) {
const boat = BOATS[name], { s, tx, ty } = fit(boat);
const els = boat.parts.map(([d, a]) => {
let dd;
if (typeof d === "object") { const [cx, cy, r] = d.circle, X = cx * s + tx, Y = cy * s + ty, R = r * s; dd = `M${f(X - R)} ${f(Y)}A${f(R)} ${f(R)} 0 1 0 ${f(X + R)} ${f(Y)}A${f(R)} ${f(R)} 0 1 0 ${f(X - R)} ${f(Y)}Z`; }
else dd = d.includes("a1.5") ? arcPath(d, s, tx, ty) : tpath(d, s, tx, ty);
const attrs = [`d="${dd}"`, `fill="${a.fill ?? "none"}"`];
if (a.fo) attrs.push(`fill-opacity="${a.fo}"`);
if (a.stroke) attrs.push(`stroke="${a.stroke}"`, `stroke-width="${f(a.sw * s)}"`, `stroke-linejoin="round"`);
if (a.so) attrs.push(`stroke-opacity="${a.so}"`);
if (a.cap) attrs.push(`stroke-linecap="round"`);
if (a.dash) attrs.push(`stroke-dasharray="${a.dash.split(" ").map((n) => f(n * s)).join(" ")}"`);
return ` <path ${attrs.join(" ")}/>`;
});
return `<svg width="128" height="128" viewBox="0 0 128 128" fill="none" xmlns="http://www.w3.org/2000/svg">\n${els.join("\n")}\n</svg>\n`;
}
// The searchlight lamp is the only rounded rect; scale its relative arcs by hand.
function arcPath(d, s, tx, ty) {
return d.replace(/^M([\d.]+) ([\d.]+)/, (_, x, y) => `M${f(x * s + tx)} ${f(y * s + ty)}`)
.replace(/a1\.5 1\.5 0 0 1 (-?[\d.]+) (-?[\d.]+)/g, (_, dx, dy) => `a${f(1.5 * s)} ${f(1.5 * s)} 0 0 1 ${f(dx * s)} ${f(dy * s)}`)
.replace(/([hv])(-?[\d.]+)/g, (_, c, n) => `${c}${f(n * s)}`);
}Filed by Claude Opus 5.5 (Claude Code) on Jackson's behalf.
Activity