Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(desktop): make the DMG volume icon read as native macOS
Elian Doran03fd075b5333
diff --git a/apps/desktop/electron-forge/dmg-icon/README.md b/apps/desktop/electron-forge/dmg-icon/README.mdindex d96cb2f780..95483b22ed 100644--- a/apps/desktop/electron-forge/dmg-icon/README.md+++ b/apps/desktop/electron-forge/dmg-icon/README.md@@ -54,6 +54,24 @@ Matching it means the icon reads as a disk image in the system's own language inbox. The one deliberate departure is the glyph: Apple's grey download arrow becomes the brand mark infull colour, which is the entire point of shipping our own.+Three details do most of the work of looking native, and each was got wrong first:++- **No outline stroke.** The reference has none anywhere — the silhouette is defined purely by+ shading. A uniform stroke is what makes an icon read as a picture frame rather than a drive. The+ only stroke here is the small-slot rescue below, and it fades out entirely by 128px.+- **Lateral bevel instead.** The shell darkens at each extreme edge with a bright band just inside+ it, so it reads as curved moulding catching light. This is what replaces the outline.+- **The plinth is a capsule, not a band.** Radius = half its height, so its rounded top corners let+ the body show behind them and it reads as a metal foot standing in front of the shell. A+ full-width rectangle reads as a stripe printed on it. It is also drawn *after* the bevel — drawn+ before, the bevel's bright lateral bands wash the foot back to body tone.++And one thing that is deliberately **absent**: a soft contact shadow above the plinth. It is the+obvious way to sell "this part stands in front", and it is wrong. Measured down the centre column,+the reference holds the body at 235 right up to the join and then steps to 210; a gradient haze sags+the body to ~205 first and destroys exactly the crisp step that reads as an edge. A thin dark seam+capsule, offset a few units up so it follows the same curve, does the job.+An earlier attempt used a **landscape** body with a dark inset face plate and a wide media slot,loosely after Firefox's. It's a defensible look — Firefox's is a variation on Apple's older *externaldrive* icon — but it is not what a disk image looks like on this system, and the landscape silhouettediff --git a/apps/desktop/electron-forge/dmg-icon/preview-large.png b/apps/desktop/electron-forge/dmg-icon/preview-large.pngindex 0711c51bf2..f8074a098d 100644Binary files a/apps/desktop/electron-forge/dmg-icon/preview-large.png and b/apps/desktop/electron-forge/dmg-icon/preview-large.png differdiff --git a/apps/desktop/electron-forge/dmg-icon/preview-small.png b/apps/desktop/electron-forge/dmg-icon/preview-small.pngindex d8cc037e29..614b403d43 100644Binary files a/apps/desktop/electron-forge/dmg-icon/preview-small.png and b/apps/desktop/electron-forge/dmg-icon/preview-small.png differdiff --git a/apps/desktop/electron-forge/dmg-icon/volume-dev.icns b/apps/desktop/electron-forge/dmg-icon/volume-dev.icnsindex c069910d81..d3628999e7 100644Binary files a/apps/desktop/electron-forge/dmg-icon/volume-dev.icns and b/apps/desktop/electron-forge/dmg-icon/volume-dev.icns differdiff --git a/apps/desktop/electron-forge/dmg-icon/volume-icon.html b/apps/desktop/electron-forge/dmg-icon/volume-icon.htmlindex cedd922468..eb21de285d 100644--- a/apps/desktop/electron-forge/dmg-icon/volume-icon.html+++ b/apps/desktop/electron-forge/dmg-icon/volume-icon.html@@ -37,32 +37,50 @@<stop offset="0.45" stop-color="#eeeff2"/><stop offset="1" stop-color="#dcdee3"/></linearGradient>- <!-- Moulded plastic edge, sampled across the reference's left edge: a bright rim, a- darker hairline a few px in, then the interior. This is what stops the body- reading as a flat rectangle — and at the 16pt slot the outline is most of- what still says "drive", so it is deliberately stronger than the reference's. -->- <linearGradient id="edge" x1="0" y1="0" x2="1" y2="0">- <stop offset="0" stop-color="#d9dade" stop-opacity="1"/>- <stop offset="0.015" stop-color="#c7c8cd" stop-opacity="1"/>- <stop offset="0.045" stop-color="#eceded" stop-opacity="0.75"/>- <stop offset="0.12" stop-color="#ffffff" stop-opacity="0"/>- <stop offset="0.88" stop-color="#ffffff" stop-opacity="0"/>- <stop offset="0.955" stop-color="#e4e5e8" stop-opacity="0.75"/>- <stop offset="0.985" stop-color="#c5c6cb" stop-opacity="1"/>- <stop offset="1" stop-color="#d6d7db" stop-opacity="1"/>+ <!-- Lateral bevel — the single biggest thing separating a native-looking drive from a+ flat rectangle. The reference has NO outline stroke anywhere: the silhouette is+ defined purely by shading, the shell darkening at each extreme edge with a bright+ band just inside it, so it reads as a curved moulding catching light. -->+ <linearGradient id="bevel" x1="0" y1="0" x2="1" y2="0">+ <stop offset="0" stop-color="#7d828d" stop-opacity="0.34"/>+ <stop offset="0.012" stop-color="#8d919b" stop-opacity="0.20"/>+ <stop offset="0.035" stop-color="#ffffff" stop-opacity="0.55"/>+ <stop offset="0.10" stop-color="#ffffff" stop-opacity="0.16"/>+ <stop offset="0.22" stop-color="#ffffff" stop-opacity="0"/>+ <stop offset="0.78" stop-color="#ffffff" stop-opacity="0"/>+ <stop offset="0.90" stop-color="#ffffff" stop-opacity="0.24"/>+ <stop offset="0.962" stop-color="#ffffff" stop-opacity="0.62"/>+ <stop offset="0.986" stop-color="#8d919b" stop-opacity="0.22"/>+ <stop offset="1" stop-color="#7d828d" stop-opacity="0.36"/></linearGradient>- <!-- Base plinth: brushed silver, darker than the body so the silhouette has a foot. -->+ <!-- Light catching the drive's top face. -->+ <linearGradient id="topFace" x1="0" y1="0" x2="0" y2="1">+ <stop offset="0" stop-color="#ffffff" stop-opacity="0.95"/>+ <stop offset="1" stop-color="#ffffff" stop-opacity="0"/>+ </linearGradient>+ <!-- Base plinth: brushed metal, darker than the body so the silhouette has a foot. -->+ <!-- Keep the lit top edge NARROW. Spread over even a tenth of the plinth it stops+ reading as a machined edge and washes the whole foot out to body tone, losing the+ contrast that gives the silhouette its base. The reference drops from its highlight+ to ~207 within a few units and bottoms out around 188, against a 235-243 body. --><linearGradient id="plinth" x1="0" y1="0" x2="0" y2="1">- <stop offset="0" stop-color="#c4c6cc"/>- <stop offset="0.55" stop-color="#b2b4bb"/>- <stop offset="1" stop-color="#a2a4ac"/>+ <stop offset="0" stop-color="#fdfdfe"/>+ <stop offset="0.04" stop-color="#cdd0d6"/>+ <stop offset="0.45" stop-color="#b6b9c1"/>+ <stop offset="0.88" stop-color="#a1a4ad"/>+ <stop offset="1" stop-color="#b4b7bf"/></linearGradient>+ <!-- NO soft contact shadow above the plinth. It is the obvious way to sell "this part+ stands in front", and it is wrong here: measured down the centre column, the+ reference holds the body at 235 right up to the join and then steps to 210, while+ a gradient haze sags the body to ~205 first and destroys exactly the crisp step+ that reads as an edge. A thin dark seam line does the job instead. --><!-- Rounded bottom corners are the body's, so the plinth is drawn clipped to it. --><clipPath id="bodyClip"><rect x="152" y="74" width="719" height="877" rx="60"/></clipPath>- <filter id="shade" x="-20%" y="-20%" width="140%" height="140%">- <feDropShadow dx="0" dy="10" stdDeviation="14" flood-color="#4c5261" flood-opacity="0.34"/>+ <filter id="shade" x="-25%" y="-25%" width="150%" height="150%">+ <feDropShadow dx="0" dy="14" stdDeviation="20" flood-color="#4c5261" flood-opacity="0.26"/></filter></defs>@@ -70,19 +88,29 @@<rect x="152" y="74" width="719" height="877" rx="60" fill="url(#body)"/><g clip-path="url(#bodyClip)">- <!-- Plinth, its seam, and the highlight the reference catches just below it. -->- <rect x="152" y="845" width="719" height="106" fill="url(#plinth)"/>- <rect x="152" y="838" width="719" height="7" fill="#82858c" fill-opacity="0.55"/>- <rect x="152" y="845" width="719" height="4" fill="#ffffff" fill-opacity="0.85"/>+ <rect x="152" y="74" width="719" height="70" fill="url(#topFace)"/>++ <!-- Bevel goes on the SHELL, before the plinth — drawn over it instead, its bright+ lateral bands wash the foot back to body tone and the base stops reading. -->+ <rect x="152" y="74" width="719" height="877" rx="60" fill="url(#bevel)"/>++ <!-- The plinth is a CAPSULE (radius = half its height), not a band spanning the+ full width. Its rounded top corners let the body show behind them, which is+ what makes it read as a metal foot standing in front of the shell rather than+ a stripe printed on it. Only its bottom corners are the body's, via the clip.+ The dark capsule behind it, offset a few units up, is the seam — it follows+ the same curve, so the join stays crisp around the rounded ends too. -->+ <rect x="152" y="840" width="719" height="107" rx="53.5"+ fill="#5f636e" fill-opacity="0.5"/>+ <rect x="152" y="844" width="719" height="107" rx="53.5" fill="url(#plinth)"/><!-- Activity LED, right of centre on the plinth. --><circle cx="790" cy="898" r="14" fill="#ffffff" fill-opacity="0.92"/></g>-- <rect x="152" y="74" width="719" height="877" rx="60" fill="url(#edge)"/>- <!-- Outline width is set per slot by the script below, NOT fixed here. See the note- there: a constant design-space stroke vanishes at the small slots. -->+ <!-- Outline width AND opacity are set per slot by the script below, NOT fixed here.+ See the note there: this exists only to rescue the small slots, and is faded out+ entirely by the time the icon is big enough for the bevel to do the work. --><rect id="outline" x="152" y="74" width="719" height="877" rx="60" fill="none"- stroke="#868c99" stroke-opacity="0.85"/>+ stroke="#868c99"/></g><!-- Brand mark, single-sourced from the client's icon SVG (injected by generate.mts).@@ -101,9 +129,16 @@// area, so it shrinks gracefully; a stroke is a *width*, and a fixed 5 design units is 0.08// device px at the 16pt slot — i.e. gone, taking the drive silhouette with it and leaving the// mark floating on a white blob. Apple avoids this by hand-tuning their small slots. Deriving- // the width from the slot scale gets the same result from one artwork: ~1.1 device px at the- // small slots, and a proportionate 5 units once the icon is big enough to carry it.- document.getElementById("outline").setAttribute("stroke-width", Math.max(5, 1.1 / scale));+ // the width from the slot scale gets the same result from one artwork: ~1.1 device px wherever+ // the slot is small enough to need it.+ //+ // It is a RESCUE for those slots, not part of the design: the reference has no outline at all,+ // and carrying one into the large slots is exactly what makes an icon read as a picture frame+ // instead of a drive. So it fades out as the bevel takes over — full below 64px, gone by 128.+ const outline = document.getElementById("outline");+ const px = 1024 * scale;+ outline.setAttribute("stroke-width", Math.max(5, 1.1 / scale));+ outline.setAttribute("stroke-opacity", 0.8 * Math.min(1, Math.max(0, (128 - px) / 64)));</script></body></html>diff --git a/apps/desktop/electron-forge/dmg-icon/volume.icns b/apps/desktop/electron-forge/dmg-icon/volume.icnsindex f7170728b7..c4ffc7efce 100644Binary files a/apps/desktop/electron-forge/dmg-icon/volume.icns and b/apps/desktop/electron-forge/dmg-icon/volume.icns differ