Please comment to claim before starting; check current assignees and linked PRs.
Context
Ten example onStart functions on dev (7cd0d6618e) each carry the same start-theme resolver: the theme ?theme= names when it is configured, else neo-theme-neo-dark when Neo.config.prefersDarkTheme is set and that theme is configured, else themes[0]:
examples/board/{basic,cardDesigns,cardEditor,columns,multiSelect,swimlanes,wipLimits}/app.mjs
examples/form/validation/app.mjs, examples/gantt/dependencies/app.mjs, examples/grid/tree/app.mjs
A defect-note (Vega, 2026-11-21) named the shape: the choice "has no single home in the engine". The open #21755 would copy the same twelve lines into 15 more app.mjs files; its review asks it not to and links here.
The Problem
Each copy is twelve lines that must stay identical, and each new example that wants the same start copies them again. A change to the rule (another dark theme, another query name) has to find every copy.
The Architectural Reality
Design authority: n/a — this calls no existing behavior wrong; each example keeps the start it has today.
src/util/Theme.mjs holds dependency-free theme rules shared by the runtime and source tooling (getThemeNamespace()), so a pure function over config values fits there.
Neo.config.prefersDarkTheme is set on the main thread from matchMedia('(prefers-color-scheme: dark)') (src/worker/Manager.mjs); Neo.config.url and Neo.config.themes reach the App worker with it.
main.addon.Stylesheet#addGlobalCss stamps themes[0] on the body; a root viewport mirrors its own theme there (container.Viewport#syncBodyTheme).
The Fix
Add resolveStartTheme({prefersDarkTheme, themes, url}) to src/util/Theme.mjs, returning the rule above, with @summary JSDoc. The ten onStart functions import it and pass its result as mainView.theme; their own copies go.
Acceptance Criteria
Out of Scope
- Whether the other examples should honour the system preference: each example opts in by calling the function.
- The Portal's stored theme choice (
apps/portal/view/ViewportController.mjs).
- A dark theme other than
neo-theme-neo-dark.
Avoided Traps
- Resolving the start theme for every app inside the engine's boot: it would change the start of every app that does not opt in today.
- Picking the dark theme by its name containing
dark: the engine removed those name heuristics; the function names its theme.
Related
#21755 (the review that found it) · #21704 (theme switchers in the examples).
Live latest-open + closed sweep: latest 20 open, plus open searches "start theme prefersDarkTheme" and "theme query parameter app.mjs" and closed searches "start theme prefersDarkTheme examples" and "start theme resolver" (Out of Scope read on #8727) at 2026-11-21T07:05Z; no equivalent. Open issues: 77 (red band); no open ticket or epic owns example boot code, so this files standalone. A2A claim sweep (last 30, all states), Memory Core sweep ("examples start in the light theme on a system that prefers dark; every app.mjs re-implements the theme choice") and own assignments: no overlap.
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Retrieval Hint: "examples start theme resolver prefersDarkTheme app.mjs copies util Theme"
Please comment to claim before starting; check current assignees and linked PRs.
Context
Ten example
onStartfunctions ondev(7cd0d6618e) each carry the same start-theme resolver: the theme?theme=names when it is configured, elseneo-theme-neo-darkwhenNeo.config.prefersDarkThemeis set and that theme is configured, elsethemes[0]:examples/board/{basic,cardDesigns,cardEditor,columns,multiSelect,swimlanes,wipLimits}/app.mjsexamples/form/validation/app.mjs,examples/gantt/dependencies/app.mjs,examples/grid/tree/app.mjsA defect-note (Vega, 2026-11-21) named the shape: the choice "has no single home in the engine". The open #21755 would copy the same twelve lines into 15 more
app.mjsfiles; its review asks it not to and links here.The Problem
Each copy is twelve lines that must stay identical, and each new example that wants the same start copies them again. A change to the rule (another dark theme, another query name) has to find every copy.
The Architectural Reality
Design authority: n/a — this calls no existing behavior wrong; each example keeps the start it has today.
src/util/Theme.mjsholds dependency-free theme rules shared by the runtime and source tooling (getThemeNamespace()), so a pure function over config values fits there.Neo.config.prefersDarkThemeis set on the main thread frommatchMedia('(prefers-color-scheme: dark)')(src/worker/Manager.mjs);Neo.config.urlandNeo.config.themesreach the App worker with it.main.addon.Stylesheet#addGlobalCssstampsthemes[0]on the body; a root viewport mirrors its ownthemethere (container.Viewport#syncBodyTheme).The Fix
Add
resolveStartTheme({prefersDarkTheme, themes, url})tosrc/util/Theme.mjs, returning the rule above, with@summaryJSDoc. The tenonStartfunctions import it and pass its result asmainView.theme; their own copies go.Acceptance Criteria
resolveStartTheme(): a configured?theme=, an unknown?theme=, a dark system with and withoutneo-theme-neo-darkconfigured, and a light system.grep -rln "dark *= *'neo-theme-neo-dark'" examplesprints nothing.devfor a light system, a dark system, and?theme=neo-theme-light.Out of Scope
apps/portal/view/ViewportController.mjs).neo-theme-neo-dark.Avoided Traps
dark: the engine removed those name heuristics; the function names its theme.Related
#21755 (the review that found it) · #21704 (theme switchers in the examples).
Live latest-open + closed sweep: latest 20 open, plus open searches "start theme prefersDarkTheme" and "theme query parameter app.mjs" and closed searches "start theme prefersDarkTheme examples" and "start theme resolver" (Out of Scope read on #8727) at 2026-11-21T07:05Z; no equivalent. Open issues: 77 (red band); no open ticket or epic owns example boot code, so this files standalone. A2A claim sweep (last 30, all states), Memory Core sweep ("examples start in the light theme on a system that prefers dark; every app.mjs re-implements the theme choice") and own assignments: no overlap.
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Retrieval Hint: "examples start theme resolver prefersDarkTheme app.mjs copies util Theme"