From 104d4bab525b9a81162dd608135520601c7ede1a Mon Sep 17 00:00:00 2001 From: "DESKTOP-T0O5CDB\\DESK-555BD" Date: Mon, 23 Sep 2024 08:31:54 -0600 Subject: [PATCH] Added switch for adaptive color mode. --- Helper/ConfigHelper.cs | 1 + Models/UserConfig.cs | 1 + Views/Home/_Settings.cshtml | 8 ++++++-- Views/Shared/_Layout.cshtml | 3 ++- appsettings.json | 1 + wwwroot/defaults/en_US.json | 2 +- wwwroot/js/settings.js | 15 +++++++++++++++ 7 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Helper/ConfigHelper.cs b/Helper/ConfigHelper.cs index 482fe074..e3c13f49 100644 --- a/Helper/ConfigHelper.cs +++ b/Helper/ConfigHelper.cs @@ -179,6 +179,7 @@ public UserConfig GetUserConfig(ClaimsPrincipal user) { EnableCsvImports = bool.Parse(_config[nameof(UserConfig.EnableCsvImports)]), UseDarkMode = bool.Parse(_config[nameof(UserConfig.UseDarkMode)]), + UseSystemColorMode = bool.Parse(_config[nameof(UserConfig.UseSystemColorMode)]), UseMPG = bool.Parse(_config[nameof(UserConfig.UseMPG)]), UseDescending = bool.Parse(_config[nameof(UserConfig.UseDescending)]), EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]), diff --git a/Models/UserConfig.cs b/Models/UserConfig.cs index 4be4b943..6dbace43 100644 --- a/Models/UserConfig.cs +++ b/Models/UserConfig.cs @@ -3,6 +3,7 @@ public class UserConfig { public bool UseDarkMode { get; set; } + public bool UseSystemColorMode { get; set; } public bool EnableCsvImports { get; set; } public bool UseMPG { get; set; } public bool UseDescending { get; set; } diff --git a/Views/Home/_Settings.cshtml b/Views/Home/_Settings.cshtml index dc59df8c..e3eff277 100644 --- a/Views/Home/_Settings.cshtml +++ b/Views/Home/_Settings.cshtml @@ -13,10 +13,14 @@
-
- +
+
+
+ + +
diff --git a/Views/Shared/_Layout.cshtml b/Views/Shared/_Layout.cshtml index 8c0820c5..8a916a13 100644 --- a/Views/Shared/_Layout.cshtml +++ b/Views/Shared/_Layout.cshtml @@ -5,6 +5,7 @@ @{ var userConfig = config.GetUserConfig(User); var useDarkMode = userConfig.UseDarkMode; + var useSystemColorMode = userConfig.UseSystemColorMode; var enableCsvImports = userConfig.EnableCsvImports; var useMPG = userConfig.UseMPG; var useMarkDown = userConfig.UseMarkDownOnSavedNotes; @@ -128,7 +129,7 @@
-@if (!useDarkMode) +@if (useSystemColorMode) {