Add theme switcher with drop-in theme discovery#295
Open
mageaustralia wants to merge 1 commit intoabhinavxd:mainfrom
Open
Add theme switcher with drop-in theme discovery#295mageaustralia wants to merge 1 commit intoabhinavxd:mainfrom
mageaustralia wants to merge 1 commit intoabhinavxd:mainfrom
Conversation
Adds a tiny extensibility module so users and forks can build their own UI themes without modifying any upstream files. Defaults are unchanged: the switcher UI hides itself when only the default theme is registered, and the default theme uses no `data-theme` attribute, so stock installs see zero visual or DOM change. Themes live under `frontend/apps/main/src/themes/<name>/` and are auto-discovered via Vite glob. Adding a theme is two files (`theme.js` + `theme.scss`) and zero edits to upstream code. Out of scope: swapping Vue components — this is CSS-only theming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a tiny extensibility module so users and forks can build their own UI themes without modifying any upstream files. Defaults are unchanged — the switcher UI hides itself when only the default theme is registered, and the default theme uses no
data-themeattribute, so stock installs see zero visual or DOM change.Pathway towards modular themes that don't conflict with core
A common pain for downstream users today is that any visual customisation requires patching upstream Vue/SCSS files, which conflict on every release. This PR proposes a contract that breaks that cycle for CSS-based theming:
frontend/apps/main/src/themes/<name>/and are auto-discovered via Vite glob (import.meta.glob). Adding a theme requires zero edits to upstream files — no rebase pain.[data-theme="<name>"]selectors, so they never bleed into the default look.A theme is two files:
(See the README in that directory for the full convention.)
Choice persists in
localStorageand syncs across tabs viauseStorage.Out of scope: swapping Vue components (custom layouts, replacement message bubbles, etc.) — that's a separate, larger discussion around component override points. This PR covers visual theming via CSS only.
Test plan
<html>has nodata-themeattribute, no visual difference vsmainthemes/foo/theme.jsexporting{ id: 'foo', label: 'Foo' }andthemes/foo/theme.scsswith[data-theme="foo"] { --primary: ... }→ switcher appears in the icon rail; picking "Foo" setsdata-theme="foo"on<html>and the styles applyuseStorage)