Fixed the system theme overriding a fixed color theme

This commit is contained in:
Thorsten Sommer 2026-09-22 22:15:21 +02:00
parent c9d3760435
commit 50c686aa9d
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 18 additions and 8 deletions

View File

@ -102,4 +102,4 @@
</MudLayout> </MudLayout>
</MudPaper> </MudPaper>
<MudThemeProvider @ref="@this.themeProvider" Theme="@this.ColorTheme" IsDarkMode="@this.useDarkMode" /> <MudThemeProvider @ref="@this.themeProvider" Theme="@this.ColorTheme" IsDarkMode="@this.useDarkMode" ObserveSystemThemeChange="@this.FollowSystemTheme" />

View File

@ -144,7 +144,7 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
// Send a message to start the plugin system: // Send a message to start the plugin system:
await this.MessageBus.SendMessage<bool>(this, Event.STARTUP_PLUGIN_SYSTEM); await this.MessageBus.SendMessage<bool>(this, Event.STARTUP_PLUGIN_SYSTEM);
await this.themeProvider.WatchSystemDarkModeAsync(this.SystemeThemeChanged); await this.themeProvider.WatchSystemDarkModeAsync(this.SystemThemeChanged);
await this.UpdateThemeConfiguration(); await this.UpdateThemeConfiguration();
this.LoadNavItems(); this.LoadNavItems();
this.LoadEmbeddingItem(); this.LoadEmbeddingItem();
@ -564,19 +564,28 @@ public partial class MainLayout : LayoutComponentBase, IMessageBusReceiver, ILan
} }
} }
private async Task SystemeThemeChanged(bool isDark) /// <summary>
/// True, when the user wants AI Studio to follow the light or dark mode of the operating system.
/// </summary>
/// <remarks>
/// This also decides whether the MudThemeProvider watches the operating system at all. On a system
/// change, the provider takes the new mode into its own state first and calls our handler only
/// afterward, so the handler cannot prevent it. Nor can a new render of this layout undo it: the
/// provider takes over its IsDarkMode parameter only when that value changes, and with a fixed theme,
/// it never does. Were the provider watching while the user chose a fixed theme, MudBlazor would show
/// the colors of the system from the next render on, while the rest of the app kept the chosen ones.
/// </remarks>
private bool FollowSystemTheme => this.SettingsManager.ConfigurationData.App.PreferredTheme is Themes.SYSTEM;
private async Task SystemThemeChanged(bool isDark)
{ {
this.Logger.LogInformation($"The system theme changed to {(isDark ? "dark" : "light")}."); this.Logger.LogInformation($"The system theme changed to {(isDark ? "dark" : "light")}.");
if (this.SettingsManager.ConfigurationData.App.PreferredTheme is not Themes.SYSTEM)
return;
await this.UpdateThemeConfiguration(); await this.UpdateThemeConfiguration();
} }
private async Task UpdateThemeConfiguration() private async Task UpdateThemeConfiguration()
{ {
if (this.SettingsManager.ConfigurationData.App.PreferredTheme is Themes.SYSTEM) if (this.FollowSystemTheme)
this.useDarkMode = await this.themeProvider.GetSystemDarkModeAsync(); this.useDarkMode = await this.themeProvider.GetSystemDarkModeAsync();
else else
this.useDarkMode = this.SettingsManager.ConfigurationData.App.PreferredTheme == Themes.DARK; this.useDarkMode = this.SettingsManager.ConfigurationData.App.PreferredTheme == Themes.DARK;

View File

@ -87,5 +87,6 @@
- Fixed AI Studio trying for minutes when a provider turns a request down for good. Such an answer does not change by asking a second time, so AI Studio now stops at the first one and tells you what the provider said about it. - Fixed AI Studio trying for minutes when a provider turns a request down for good. Such an answer does not change by asking a second time, so AI Studio now stops at the first one and tells you what the provider said about it.
- Fixed errors about a provider arriving as two messages at once, the second of which spoke of several attempts that were never made. You now get the single message which names the cause. - Fixed errors about a provider arriving as two messages at once, the second of which spoke of several attempts that were never made. You now get the single message which names the cause.
- Fixed the button in the chat toolbar that deletes the current chat and starts a new one doing so without asking. It now asks for your confirmation first, just like the chat list does, because a deleted chat cannot be brought back. The button shows a delete icon in red now, instead of one that looked like a reload. - Fixed the button in the chat toolbar that deletes the current chat and starts a new one doing so without asking. It now asks for your confirmation first, just like the chat list does, because a deleted chat cannot be brought back. The button shows a delete icon in red now, instead of one that looked like a reload.
- Fixed AI Studio following your system into light or dark mode even though you had chosen a fixed color theme in the app settings.
- Upgraded the Visual Briefing assistant (in preview) from the prototype to the beta state. The assistant is now completely implemented and is undergoing a deeper testing phase in preparation for release. To try it, open the app settings, allow preview features down to beta, and then enable the Visual Briefing assistant there. - Upgraded the Visual Briefing assistant (in preview) from the prototype to the beta state. The assistant is now completely implemented and is undergoing a deeper testing phase in preparation for release. To try it, open the app settings, allow preview features down to beta, and then enable the Visual Briefing assistant there.
- Upgraded the vector database behind local RAG (Qdrant Edge) to version 0.8.0. - Upgraded the vector database behind local RAG (Qdrant Edge) to version 0.8.0.