Skip to content

feat: add color theme switching and expose admin theme to iframe apps#1181

Draft
Fabian Hüske (fabianhueske) wants to merge 1 commit into
mainfrom
feat/theme-switching
Draft

feat: add color theme switching and expose admin theme to iframe apps#1181
Fabian Hüske (fabianhueske) wants to merge 1 commit into
mainfrom
feat/theme-switching

Conversation

@fabianhueske

Copy link
Copy Markdown
Contributor

Description

Adds color theme switching for Meteor apps and exposes the Administration's resolved theme to iframe apps through the Admin SDK.

Closes #1174
Closes #1129

Component library (#1174)

  • mt-theme-select — a select component for choosing the application color theme (light, dark, system), with localized labels (en/de) and Storybook stories.
  • useColorScheme composable — tracks the user's preference, resolves system against prefers-color-scheme, applies the resolved theme to a target's data-theme attribute, and persists the choice to localStorage.
    • Options: storageKey (set null to disable persistence), target, defaultScheme, applyToTarget.
    • Returns scheme, resolvedScheme, setScheme, and stop (to detach the OS-preference listener when used outside an effect scope; cleanup is automatic inside a component/effectScope).
  • Exports the component, composable, and its types from the package entry point.

Admin SDK (#1129)

  • context.getTheme() — resolves the current Administration theme; a system preference is always resolved to light or dark.
  • context.subscribeTheme(cb) — fires whenever the resolved theme changes; returns an unsubscribe function.
  • context.syncTheme({ target? }) — mirrors the resolved theme onto an element's data-theme attribute (document root by default), applies it immediately, and keeps it in sync. Subscribes before the initial fetch so a change during startup can't be missed.
  • Documented in the Context API reference, including a minimal iframe app example.

Tests

  • useColorScheme.spec.ts — defaults, system resolution, explicit preference, persistence, OS-change reactivity, custom target, applyToTarget: false, scope disposal, manual stop(), and disabled persistence.
  • mt-theme-select.spec.ts — label rendering, options, re-emit, disabled, custom label.
  • theme.spec.ts (admin-sdk) — getTheme, subscribe/unsubscribe, and syncTheme to document root and custom target.

Changesets

  • @shopware-ag/meteor-component-library: minor
  • @shopware-ag/meteor-admin-sdk: minor

Adds an mt-theme-select component and useColorScheme composable for
switching the application color theme (light/dark/system), and exposes
the resolved Administration theme to iframe apps via the Admin SDK
(getTheme, subscribeTheme, syncTheme).

Closes #1174
Closes #1129
@vercel

vercel Bot commented Jun 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
meteor-component-library Ready Ready Preview, Comment Jun 23, 2026 1:02pm

Request Review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Theme switch component Admin SDK: expose admin theme to iframe apps

1 participant