Skip to content

Keep the theme in sync between native and Blazor UI in hybrid apps #29

Open

Description

@Shewart

Summary

In a MAUI Blazor Hybrid app, ShellTheme (native) and the Blazor dark class on <html> change independently, so toggling one leaves the other on the wrong theme.

Proposal

A small helper, or a documented pattern:

  • Blazor → native: a JS → .NET callback from the Blazor ThemeToggle that sets ShellTheme.
  • Native → Blazor: when ShellTheme changes, run a script in the BlazorWebView that sets or removes the dark class.

Also document how to mirror a custom Blazor theme (tweakcn or hex values in input.css) into ShellTheme overrides, so both halves use the same colours.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions