The app's own mark: assets/logoym.png becomes the icon, the brand, and the Start button
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

Every icon the app ships now comes from one source image, generated rather than drawn:
frontend/scripts/build-app-icons.mjs writes public/icon-512.png (declared "any maskable"
in the manifest, hence an opaque square), public/icon-180.png (iOS home screen and
favicon), public/logo.png (transparent, for the UI) and resources/icon.png (the
@capacitor/assets source for the native shells).

The file was a PNG despite its .jpeg name — it has a real alpha channel — so it is
assets/logoym.png now. It is the file the owner dropped in, and the icons are derived
from it, which is what keeps the PWA icon, the home-screen icon, the in-app mark and the
native icon from ever drifting apart.

The emblem is dark green (its most common colour is #031808, its accents are greens too)
with transparent corners, which decides two things. The icon squares are filled with that
same dark green and the mark is centred at 88% of the canvas: the corners blend into it,
the maskable safe circle stays clean, and a transparent icon can't disappear on a dark
home screen. And the tab bar's Start button keeps the accent as a RING instead of a fill —
on the old lime disc the emblem would have read as a dark blob. The ring still marks the
primary action, and it still turns orange with the pulse while a session is running, with
the label underneath saying Start / Resume / Workout, so nothing that button communicated
was lost by swapping its glyph for the mark.

Login, the mobile onboarding and the boot placeholder in App.jsx showed the dumbbell glyph
as a stand-in for the brand; they all show the mark now, so the app cannot flash a
different logo on its way in. Three now-unused Icon imports go with it.

Icons are written as 256-colour palettes: measured against the full RGBA versions the mean
per-channel error is 1.5/255, invisible, and the files are ~2.5× smaller (161 KB for
everything the browser downloads, against 532 KB of source). Transparency survives it as
the palette's own alpha entries — verified, not assumed.

docs/MOBILE.md says how to regenerate and why resources/icon.svg is now inert
(@capacitor/assets tries .png before .svg, so the new icon.png wins), and that comment is
repeated in the SVG itself so nobody edits the file that no longer decides anything.
This commit is contained in:
dsantillan committed 2026-09-23 10:41:33 -04:00
1 parent ba37ef8a44
commit c150101232
14 files changed
+146 -25

No files matched your search

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

+21 -5
View File
@@ -67,16 +67,32 @@ into both native projects — re-run it after every web-code change before build
## App icons & splash screens
`frontend/resources/icon.svg` is the 1024×1024 source (the app's dumbbell glyph on the
app background). Generate all platform assets from it on a machine with the tooling:
`frontend/resources/icon.png` (1024×1024) is the source: the app's brand image from
`assets/logoym.png`, centred on the emblem's own dark green so the square is fully opaque — a
maskable icon may not be transparent. It is **generated**, not hand-drawn, so replacing the brand
image means regenerating every icon the app ships, in one step:
```sh
cd frontend
npx @capacitor/assets generate --iconBackgroundColor '#0c0e12' --splashBackgroundColor '#0c0e12'
node scripts/build-app-icons.mjs
```
(If the generator won't take the SVG directly, export it to `resources/icon.png` at
1024×1024 first — any image tool can do it.)
That writes `resources/icon.png` plus the three the web app serves: `public/icon-512.png` (declared
`any maskable` in the manifest, hence the opaque background), `public/icon-180.png` (iOS home screen
and favicon) and `public/logo.png` (transparent, for the tab bar's Start button, the login screen
and the boot placeholder). Change `ICON_BG` in that script to re-skin all of them at once.
Then generate the platform assets from it:
```sh
cd frontend
npx @capacitor/assets generate --splashBackgroundColor '#0c0e12'
```
The icon's background colour is already baked into `icon.png`, so only the splash needs one here.
`resources/icon.svg` is the vector drawing of the dumbbell glyph the app used before it had this
mark: nothing generates from it any more (`@capacitor/assets` prefers `.png` over `.svg` in the same
directory — see the extension order in its `loadInputAsset`), and it is kept only as that drawing.
## Distribution — deliberately no app stores
Binary file not shown.

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

+4 -3
View File
@@ -1,7 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 512 512">
<!-- App-icon source == the PWA icon (public/icon-512.png), geometry traced 1:1 so the
native app, the home-screen PWA and the website favicon all show the same icon.
Generate platform icons + splash via `npx @capacitor/assets generate` — docs/MOBILE.md. -->
<!-- The dumbbell glyph this app used before it had a brand mark. NOTHING GENERATES FROM THIS
ANY MORE: resources/icon.png (written by frontend/scripts/build-app-icons.mjs, from the
image in assets/) sits beside it and wins — @capacitor/assets tries .png before .svg. It
is kept as the vector drawing; see docs/MOBILE.md, "App icons & splash screens". -->
<rect width="512" height="512" fill="#0c0e12"/>
<g fill="#a3e635">
<rect x="80" y="242" width="352" height="28"/>

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 814 B

+74
View File
@@ -0,0 +1,74 @@
/* build-app-icons.mjs — derive every icon the app ships from one source image.
*
* The source is assets/logoym.png (a PNG despite its old .jpeg name; it has a real alpha channel,
* with the emblem's corners transparent). Everything else here is generated, so the app icon, the
* iOS home-screen icon, the in-app brand mark and the Capacitor source icon can never drift apart
* from each other or from the file the owner actually dropped in assets/.
*
* Run it after replacing the source:
*
* cd frontend && node scripts/build-app-icons.mjs
*
* `sharp` comes with @capacitor/assets (a devDependency here), which is the only reason it is
* available without adding a dependency of our own — see CONTRIBUTING.md on that.
*
* THE ONE DESIGN DECISION: the emblem is dark green (its most common colour is #031808, its light
* accents are greens too), and its corners are transparent. So a transparent icon would disappear
* on a dark home screen, and a white one would put a white card behind an already-square logo. The
* canvases below are filled with the emblem's OWN darkest green and the logo is centred at 88% of
* the square: the corners it does not cover blend into it, the maskable safe circle stays clean,
* and the icon reads as one piece at 180 px. Change ICON_BG to re-skin all of them at once.
*/
import sharp from 'sharp'
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
// sharp takes paths, not file: URLs — hence fileURLToPath here and in icon() below.
const SRC = fileURLToPath(new URL('../../assets/logoym.png', import.meta.url))
const PUB = new URL('../public/', import.meta.url)
const RES = new URL('../resources/', import.meta.url)
/** The emblem's own dominant colour (sampled from the source), used to fill the icon squares. */
const ICON_BG = '#031808'
/** Fraction of the canvas the emblem occupies. The maskable safe circle is 80% of the square, and
* the emblem's own corners are transparent, so slightly past it costs nothing and gains size. */
const ICON_FIT = 0.88
/** Longest side of the in-app mark. Displayed at 52 px (tab bar) and ~88 px (login), so 256 covers
* a 3× screen twice over; anything larger is bytes nobody looks at. */
const MARK_PX = 256
/* Every PNG here is written as a 256-colour palette. Measured against the full RGBA version the
* mean per-channel error is 1.5/255 — invisible — for a file about 2.5× smaller: the emblem is
* greens on greens, which is exactly what a palette is good at. The transparency survives as the
* palette's own alpha entries (checked: the corners really are alpha 0.) */
const PNG = { palette: true, colours: 256, compressionLevel: 9, effort: 10 }
const logo = sharp(SRC).ensureAlpha().trim()
/** One opaque square with the emblem centred in it. */
async function icon(size, out) {
const inner = Math.round(size * ICON_FIT)
const placed = await logo.clone().resize(inner, inner, { fit: 'inside' }).png().toBuffer()
await sharp({ create: { width: size, height: size, channels: 4, background: ICON_BG } })
.composite([{ input: placed, gravity: 'centre' }])
.png(PNG)
.toFile(fileURLToPath(out))
console.log(` ${out.pathname.split('/').slice(-2).join('/')} ${size}x${size} bg ${ICON_BG}`)
}
console.log('generating app icons from assets/logoym.png')
// The two the web app ships: icon-512 is declared "any maskable" in manifest.json (hence the
// opaque background and the centred emblem), icon-180 is the iOS home screen and the favicon.
await icon(512, new URL('icon-512.png', PUB))
await icon(180, new URL('icon-180.png', PUB))
// The in-app brand mark: transparent, so it sits on the page's own background. Used by the tab
// bar's Start button, the login screen and the boot placeholder.
await logo.clone().resize(MARK_PX, MARK_PX, { fit: 'inside' }).png(PNG)
.toFile(fileURLToPath(new URL('logo.png', PUB)))
const mark = readFileSync(fileURLToPath(new URL('logo.png', PUB)))
console.log(` public/logo.png transparent ${(mark.length / 1024).toFixed(1)} KB`)
// The Capacitor source icon for the native shells (docs/MOBILE.md: `npx @capacitor/assets
// generate` reads resources/). Kept opaque and 1024 wide, which is what that tool wants.
await icon(1024, new URL('icon.png', RES))
+4 -3
View File
@@ -14,7 +14,6 @@ import { installChipDrag } from './lib/hchips.js'
import { syncPushSubscription } from './lib/push.js'
import { MOBILE } from './lib/mobile.js'
import { startFlow } from './sheets.jsx'
import Icon from './components/Icon.jsx'
import TabBar from './components/TabBar.jsx'
import ErrorBoundary from './components/ErrorBoundary.jsx'
import Modals from './components/Modals.jsx'
@@ -137,8 +136,10 @@ function Shell() {
const authed = user || isGuest
if (!ready && !authed) return (
<div id="app">
<div style={{ paddingTop: '44vh', display: 'flex', justifyContent: 'center', fontSize: 34, color: 'var(--label-3)' }}>
<Icon name="dumbbell" />
{/* The mark, dimmed, as the boot placeholder — the same image the login screen shows, so
the app never flashes a different logo on its way in. */}
<div style={{ paddingTop: '44vh', display: 'flex', justifyContent: 'center' }}>
<img className="brand boot" src="logo.png" alt="" />
</div>
</div>
)
+4 -1
View File
@@ -41,7 +41,10 @@ export default function TabBar({ onStart }) {
tab it is and stays lit (#29); anywhere else it brings you back to the exercise you
were on — the marker is kept in S.active.cur and never moves on its own (#21). */}
<button className={'start' + (S.active ? ' rec' : '') + (S.active && cur === 'workout' ? ' on' : '')} onClick={startWorkout}>
<span className="cir"><Icon name={S.active ? (cur === 'workout' ? 'dumbbell' : 'play') : 'dumbbell'} /></span>
{/* The app's own mark, not a glyph — see the `.cir` rules in index.css. Relative `src`,
like every other asset here: the app is served from wherever it is served from, and
`base: './'` plus a hash router means the document is always at that root. */}
<span className="cir"><img src="logo.png" alt="" /></span>
<span>{S.active ? (cur === 'workout' ? t('Workout') : t('Resume')) : t('Start')}</span>
</button>
<Tab k="stats" icon="chart" to="/stats" label={t('Stats')} />
+11
View File
@@ -55,4 +55,15 @@ describe('the tab bar', () => {
expect(clicked).toContain('/stats')
expect(clicked).toContain('/library')
})
it('puts the app\'s own mark in the raised button, not a glyph', () => {
mount()
const disc = tabs()[2].querySelector('.cir')
const img = disc?.querySelector('img')
// Relative src on purpose: the app is served from wherever it is served from (base './' plus a
// hash router keeps the document at that root), so an absolute /logo.png would miss a subpath.
expect(img?.getAttribute('src')).toBe('logo.png')
expect(disc.querySelector('.icn')).toBeNull()
expect(img.getAttribute('alt')).toBe('')
})
})
+24 -9
View File
@@ -361,21 +361,28 @@ h4.sec{
#tabbar button.on{color:var(--acc)}
#tabbar button.on .icn{--icon-stroke:2;color:inherit;opacity:1}
#tabbar button.start{margin-top:-24px}
/* The disc carries the app's own mark (public/logo.png, generated from assets/logoym.png by
scripts/build-app-icons.mjs) instead of a glyph, so it keeps the accent as a RING rather than as
a fill: the emblem is dark green, and on a lime disc it would read as a dark blob. The ring is
what still marks this as the primary action against the dark bar, and it turns orange while a
session is running — the state the old play glyph carried, alongside the label underneath.
The fill is the emblem's own darkest green, so the corners it does not cover blend into it. */
#tabbar button.start .cir{
width:52px;height:52px;border-radius:50%;background:var(--acc);color:var(--on-acc);
width:52px;height:52px;border-radius:50%;background:#031808;
border:2px solid var(--acc);
display:flex;align-items:center;justify-content:center;position:relative;
box-shadow:0 6px 18px -4px color-mix(in srgb,var(--acc) 55%,transparent);
transition:transform var(--fast) var(--ease);
transition:transform var(--fast) var(--ease),border-color var(--fast);
}
#tabbar button.start:active .cir{transform:scale(.93)}
#tabbar button.start .cir .icn{font-size:26px;--icon-stroke:2;color:inherit;opacity:1}
/* Rounded on the <img> rather than clipped with `overflow:hidden` on the disc: the recording pulse
is a ::after on .cir that scales out past it, and clipping the disc would clip that too. */
#tabbar button.start .cir img{width:100%;height:100%;border-radius:50%;object-fit:cover;display:block}
#tabbar button.start span{color:var(--acc);font-weight:600}
/* `.cir` is itself a <span>, so the label rules above and below reach it too and
outrank the `.cir` block — which is how the running state ended up painting an
orange play glyph onto an orange disc. Both states restate their own colour.
The disc is orange in either theme, so its glyph is black, not `--on-acc`. */
#tabbar button.start .cir{color:var(--on-acc)}
#tabbar button.start.rec .cir{background:var(--orange);color:#000;box-shadow:0 6px 18px -4px color-mix(in srgb,var(--orange) 55%,transparent)}
/* `.cir` is itself a <span>, so the label rule above reaches it as well. Nothing inside it reads
colour any more (the mark is an image), but the ring and the pulse are painted from the state
classes, which is why they restate themselves here. */
#tabbar button.start.rec .cir{border-color:var(--orange);box-shadow:0 6px 18px -4px color-mix(in srgb,var(--orange) 55%,transparent)}
#tabbar button.start.rec span{color:var(--orange)}
#tabbar button.start.rec .cir::after{
content:'';position:absolute;inset:0;border-radius:50%;
@@ -383,6 +390,14 @@ h4.sec{
}
@keyframes ping{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.45);opacity:0}}
/* --- the app's mark, wherever it stands for the app itself -------------------------------
Login, the mobile onboarding and the boot placeholder in App.jsx all show this one image, so
the app never flashes a different logo on its way in. Sized by width and centred; the source
is the transparent PNG (public/logo.png, generated by scripts/build-app-icons.mjs), so it sits
on whatever background the screen already has rather than carrying a plate of its own. */
.brand{display:block;width:88px;height:auto;margin:0 auto}
.brand.boot{width:56px;opacity:.85}
/* NOTE on every backdrop-filter pair in this file: the -webkit- line comes first and the
standard property last, which is the order a prefixed/standard pair wants — whichever is
written last wins in the cascade, and that should be the standard name.
+3 -2
View File
@@ -6,7 +6,6 @@ import { t } from '../lib/i18n.js'
import { DEMO, REPO } from '../lib/demo.js'
import { guestAllowed } from '../lib/guest.js'
import { useState, useRef, useEffect } from 'react'
import Icon from '../components/Icon.jsx'
import { Button } from '../components/ui.jsx'
import { askAddDeviceData } from '../sheets.jsx'
@@ -56,7 +55,9 @@ export default function Login() {
catch (e) { if (e.name !== 'NotAllowedError' && e.name !== 'AbortError') useUI.getState().toast(e.message || t('Sign-in failed')) }
}
const head = <>
<div style={{ fontSize: 54, display: 'flex', justifyContent: 'center', color: 'var(--acc)' }}><Icon name="dumbbell" /></div>
{/* The app's mark rather than the dumbbell glyph it used to show: assets/logoym.png is the
brand now, and public/logo.png is the transparent copy of it the app ships. */}
<img className="brand" src="logo.png" alt="" />
<h1 style={{ fontSize: 34, fontWeight: 700, letterSpacing: '-.028em', margin: '10px 0 4px' }}>KuentaGYM</h1>
</>
const wrap = { display: 'flex', flexDirection: 'column', justifyContent: 'center', minHeight: '78vh', textAlign: 'center' }
+1 -2
View File
@@ -5,7 +5,6 @@ import { useState, useRef, useEffect } from 'react'
import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { t } from '../lib/i18n.js'
import Icon from '../components/Icon.jsx'
import { Button } from '../components/ui.jsx'
import { askAddDeviceData } from '../sheets.jsx'
@@ -41,7 +40,7 @@ export function ConnectSheet({ close }) {
export default function MobileOnboarding() {
const { chooseLocalMode } = useStore()
const head = <>
<div style={{ fontSize: 54, display: 'flex', justifyContent: 'center', color: 'var(--acc)' }}><Icon name="dumbbell" /></div>
<img className="brand" src="logo.png" alt="" />
<h1 style={{ fontSize: 34, fontWeight: 700, letterSpacing: '-.028em', margin: '10px 0 4px' }}>KuentaGYM</h1>
</>
const wrap = { display: 'flex', flexDirection: 'column', justifyContent: 'center', minHeight: '78vh', textAlign: 'center' }