Skip to content

feat: allow apps to provide themes - #2964

Draft
dschmidt wants to merge 1 commit into
mainfrom
feat/app-provided-themes
Draft

feat: allow apps to provide themes#2964
dschmidt wants to merge 1 commit into
mainfrom
feat/app-provided-themes

Conversation

@dschmidt

@dschmidt dschmidt commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Lets apps provide selectable themes to the theme switcher, generically (no
app-specific code in the core).

  • initializeThemes merges app-provided theme configs alongside light/dark.
  • announceTheme loads them before the first apply (no flash) and resolves
    asset paths relative to the app's own URL (works in dev and prod).
  • setAndApplyTheme sets html[data-theme] (so themes can add structural CSS)
    and clears props a theme does not define (no leak across switches, e.g. fonts).

First consumer: the Windows 95 theme extension, opencloud-eu/web-extensions#511.

Interim / draft: themes are read from external_apps[].config.themes,
piggybacking on the per-app config bag so it works without a backend change
(marked INTERIM in announceTheme). The clean shape is a first-class
external_apps[].themes field, needing coordinated changes in the opencloud
backend and extension-sdk, then a one-line switch here.

@dschmidt
dschmidt force-pushed the feat/app-provided-themes branch 2 times, most recently from 23ccd32 to 52e3aa7 Compare July 28, 2026 12:26
@dschmidt dschmidt changed the title feat: allow apps to contribute themes feat: allow apps to provide themes Jul 28, 2026
@dschmidt
dschmidt force-pushed the feat/app-provided-themes branch from 52e3aa7 to 861ffe2 Compare July 28, 2026 12:29
Adds a generic mechanism for (external) apps to provide selectable themes
to the theme switcher, without any app-specific code in the core.

- theme store: initializeThemes() merges additional theme configs, so app
  themes join the switcher alongside the deployment's light/dark themes.
- announceTheme(): reads themes from external_apps[].config.themes, loads them
  parallel to the base theme and injects their stylesheets before the first
  apply, so a persisted app-theme selection is honored on first paint without
  a flash. Asset paths are resolved relative to the app's own URL, so a theme's
  theme.json/stylesheets are found wherever the app is served (dev or prod).
- setAndApplyTheme(): expose the active theme as html[data-theme] so themes can
  attach structural CSS the token system cannot express, and reset custom props
  a theme does not define instead of leaking them from the previous theme
  (e.g. a pixel font).

Apps declare themes in their manifest's config block, which the server surfaces
in external_apps[].config; the Windows 95 theme in the web-extensions repo is
the first consumer.
@dschmidt
dschmidt force-pushed the feat/app-provided-themes branch from 861ffe2 to aa20df8 Compare July 28, 2026 17:24
@dschmidt

Copy link
Copy Markdown
Contributor Author

Of course this collides a bit with the intention of unifying themes via a central theme.json, obviously this doesnt help for mobile client e.g. :/

So not sure this is a really good idea after all, my idea was just that we have an established approach to distribute apps (unlike themes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant