diff --git a/LayerComponents/CascadingState.razor b/LayerComponents/CascadingState.razor
index 95d91bb..bf82ecf 100644
--- a/LayerComponents/CascadingState.razor
+++ b/LayerComponents/CascadingState.razor
@@ -58,6 +58,13 @@
}
}
+ /// Changes the page settings, then saves and applies them like UpdatePublicCache.
+ public ValueTask UpdatePageSettings(Action change)
+ {
+ change(PublicCacheData.PageSettings);
+ return UpdatePublicCache(PublicCacheData);
+ }
+
[JSInvokable]
public async Task LogFromJs(string message, string where)
{
diff --git a/Models/PageSettings.cs b/Models/PageSettings.cs
index f318d7c..ab3f8d0 100644
--- a/Models/PageSettings.cs
+++ b/Models/PageSettings.cs
@@ -1,4 +1,4 @@
-
+
using PrivaPub.ClientModels.Resources;
using System.ComponentModel.DataAnnotations;
@@ -24,5 +24,40 @@ namespace decePubClient.Models
public bool ThemeIsDarkGray { get; set; } = false;
public bool ShowDonatorBadge { get; set; } = false;
+
+ // How the theme flags combine is in wwwroot/js/theme.js: with PreferSystemTheming the OS picks light or dark;
+ // otherwise ThemeIsDarkGray, then ThemeIsLightGray, then ThemeIsDarkMode decide; either grey flag drops the
+ // colour. These keep the flags consistent when the UI changes one aspect.
+
+ public const short DefaultLightThemeIndexColour = 25;
+ public const short DefaultDarkThemeIndexColour = 215;
+
+ public bool IsGray() => ThemeIsLightGray || ThemeIsDarkGray;
+
+ /// Leaves system theming and shows the light or dark variant, grey or coloured as before.
+ public void SetDarkMode(bool isDark)
+ {
+ PreferSystemTheming = false;
+ ThemeIsDarkMode = isDark;
+ if (IsGray())
+ SetGray(true, isDark);
+ }
+
+ /// Switches grey on or off for the variant currently shown.
+ public void SetGray(bool isGray, bool isDark)
+ {
+ ThemeIsDarkGray = isGray && isDark;
+ ThemeIsLightGray = isGray && !isDark;
+ }
+
+ /// Sets the hue of the light or dark variant; picking a hue means colour, so grey goes off.
+ public void SetHue(bool isDark, short hue)
+ {
+ if (isDark)
+ DarkThemeIndexColour = hue;
+ else
+ LightThemeIndexColour = hue;
+ SetGray(false, isDark);
+ }
}
}
\ No newline at end of file
diff --git a/Pages/Settings.razor b/Pages/Settings.razor
index 480a953..e898458 100644
--- a/Pages/Settings.razor
+++ b/Pages/Settings.razor
@@ -6,17 +6,33 @@
-
+
@Localizer["General"]
-
-
- @Localizer["Empty"]
-
+ @* Every theme setting; NavMenu's toggle and slider are shortcuts to the dark and hue ones. *@
+