formaui-net.Framework.Themes.WebView
1.0.0-preview.27
Prefix Reserved
dotnet add package formaui-net.Framework.Themes.WebView --version 1.0.0-preview.27
NuGet\Install-Package formaui-net.Framework.Themes.WebView -Version 1.0.0-preview.27
<PackageReference Include="formaui-net.Framework.Themes.WebView" Version="1.0.0-preview.27" />
<PackageVersion Include="formaui-net.Framework.Themes.WebView" Version="1.0.0-preview.27" />
<PackageReference Include="formaui-net.Framework.Themes.WebView" />
paket add formaui-net.Framework.Themes.WebView --version 1.0.0-preview.27
#r "nuget: formaui-net.Framework.Themes.WebView, 1.0.0-preview.27"
#:package formaui-net.Framework.Themes.WebView@1.0.0-preview.27
#addin nuget:?package=formaui-net.Framework.Themes.WebView&version=1.0.0-preview.27&prerelease
#tool nuget:?package=formaui-net.Framework.Themes.WebView&version=1.0.0-preview.27&prerelease
Forma.Framework.Themes.WebView
One theme choice for a whole application, across every web view in every native window. The application reads its store
once as it starts, keeps each choice there as it changes, and every document a web view creates draws the choice in
force from its first paint, as
the theme design sets out. It
works with any web view that implements IWebViewDocuments: one that installs a script to run as each document is
created, and runs a script in the document it shows.
Install
The package comes with formaui-net.Blazor.WebView, and AddFormaWebViewIntegration() registers it through
AddFormaThemeWebViewIntegration(). Each web view takes part through its platform's package:
| Platform | Package |
|---|---|
| WPF and Windows Forms | formaui-net.Framework.Themes.WebView2 |
| MAUI on Android and Windows | formaui-net.Framework.Themes.Blazor.WebView.Maui |
What it registers
| Service | Registered as |
|---|---|
IThemeState |
Forma's own state, a singleton: one choice for the application. |
IThemeSwitch |
The application's switch, a singleton, which a component in any web view, a picker among them, and the host's native code switch through. |
WebViewThemes |
The application's choice in each web view's documents, which each platform's web view attaches to. |
Each is added with TryAdd, so a host's own registration made first is the one used, and the themes a host registers
with AddFormaThemes, before or after, are the ones every web view offers.
The theme picker
A FormaThemePicker in a web view needs the registration each web view's scope keeps with its page, which
AddFormaThemeCoordination() of formaui-net.Framework.Themes.Browser.Interop registers. AddFormaWebViewIntegration()
registers it right after AddFormaThemeWebViewIntegration(), and since it adds its switch with TryAdd, the
application's switch stays the one every switch goes through. A host registering this package alone, without the
aggregate, calls it after this package's registrar to offer the picker:
services.AddFormaThemeWebViewIntegration();
services.AddFormaThemeCoordination();
Switching
A switch is accepted at once and applied to the state, and every web view follows it on its own UI thread, in the order the switches were accepted:
- the script each web view runs as a document is created is replaced, so a reload or a web view opened after the switch draws the switched choice from its first paint;
- the document each web view shows draws it in place, keeping the reader's work.
A switch's task completes once the state's subscribers have heard of it and the store holds it or a newer choice. A
theme that isn't registered fails at once with InvalidOperationException, changing nothing. A store's write that fails
fails the switch with the store's exception, the choice staying accepted; the next switch writes the store again.
The application's store
A host that keeps the choice registers IThemePreferenceStore once for the application, as a singleton. The store is
read once, as the first web view attaches, and its choice is applied before that web view's first navigation where the
read completes as it's asked, as a native application's settings do; a store that answers later switches every web view
once it does, unless a switch came first. The store is written in the order the choices were accepted, one write at a
time, each one revision past the latest the application knows of, and a newer choice takes the place of a write that
hasn't started.
The host page
The application's wwwroot/index.html links each registered theme's stylesheet, naming its theme, as a standalone app's
page does, and loads no bootstrap, since the application draws its choice in each document itself:
<link rel="stylesheet" href="_content/Forma.Blazor/forma-tokens.css" data-forma-theme-stylesheet="forma" />
<link rel="stylesheet" href="_content/Forma.Blazor/forma-high-contrast.css" data-forma-theme-stylesheet="forma-high-contrast" />
<link rel="stylesheet" href="css/harbor-theme.css" data-forma-theme-stylesheet="harbor" />
A picker in a web view offers the themes whose stylesheets its page loaded.
A platform of its own
A platform's web view attaches through WebViewThemes.Attach(IWebViewDocuments), on its UI thread before its first
navigation. IWebViewDocuments is the web view as its platform reaches it: a script added to those it runs as each
document is created, removed by disposing what the call returns, and a script run in the document it shows. A web view
whose platform runs no script as documents are created draws the host page's default until the application's next
switch.
License
Apache License 2.0, under the repository's LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- formaui-net.Framework.State.WebView (= 1.0.0-preview.27)
- formaui-net.Framework.Themes (= 1.0.0-preview.27)
- Microsoft.Extensions.Logging (>= 11.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on formaui-net.Framework.Themes.WebView:
| Package | Downloads |
|---|---|
|
formaui-net.Blazor.WebView
The WebView half of Forma's component library: the registration a Blazor Hybrid application makes, in WPF, Windows Forms or MAUI on Windows, or MAUI on Android, iOS or Mac Catalyst, which registers what the components need in a web view, the culture its web views keep, one for the whole application by default, or one for each web view, and the theme every web view draws, the application's. |
|
|
formaui-net.Framework.Themes.WebView2
The application's theme choice in a WebView2, the web view of WPF and Windows Forms, attached to the initialized control the host supplies: every document a WebView2 creates draws it from its first paint, and the document it shows follows each choice the application accepts. |
|
|
formaui-net.Framework.Themes.Blazor.WebView.Maui
The application's theme choice in MAUI's web view, on Android and on Windows: every document a web view creates draws it from its first paint, and the document it shows follows each choice the application accepts, with no code for each web view. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.27 | 49 | 12/3/2026 |
| 1.0.0-preview.26 | 53 | 12/3/2026 |
| 1.0.0-preview.25 | 54 | 12/2/2026 |
| 1.0.0-preview.24 | 66 | 12/1/2026 |
| 1.0.0-preview.23 | 80 | 11/30/2026 |
| 1.0.0-preview.22 | 79 | 11/30/2026 |
| 1.0.0-preview.21 | 91 | 11/29/2026 |
What this release changed is in Forma's changelog: https://github.com/FormaUI/Forma/blob/v1.0.0-preview.27/CHANGELOG.md