Skip to content

Commit

Permalink
2023-06-27_01 - Theme fixes
Browse files Browse the repository at this point in the history
- Fixed windows accent option not persistent
- Fixed accent color not setting properly
- Fixed accent color not being used for window buttons
  • Loading branch information
TCNOco committed Jun 27, 2023
1 parent 38b7814 commit 93ec82b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TcNo-Acc-Switcher-Globals/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public partial class Globals
#pragma warning disable CA2211 // Non-constant fields should not be visible - This is necessary due to it being a launch parameter.
public static bool VerboseMode;
#pragma warning restore CA2211 // Non-constant fields should not be visible
public static readonly string Version = "2023-06-27_00";
public static readonly string Version = "2023-06-27_01";

#region INITIALISATION

Expand Down
7 changes: 4 additions & 3 deletions TcNo-Acc-Switcher-Server/Data/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public static AppSettings Instance
[JsonProperty("DiscordRpcShareTotalSwitches", Order = 19)] private bool _discordRpcShare = true;
[JsonProperty("PasswordHash", Order = 20)] private string _passwordHash = "";
[JsonProperty("GloballyHiddenMetrics", Order = 21)] private Dictionary<string, Dictionary<string, bool>> _globallyHiddenMetrics = new();
[JsonProperty("WindowsAccent", Order = 21)] private bool _windowsAccent;
[JsonIgnore] private bool _desktopShortcut;
[JsonIgnore] private bool _startMenu;
[JsonIgnore] private bool _startMenuPlatforms;
Expand Down Expand Up @@ -238,8 +239,6 @@ public static async Task ShowPlatform(string platform)

private string _stylesheet;
public static string Stylesheet { get => Instance._stylesheet; set => Instance._stylesheet = value; }

private bool _windowsAccent;
public static bool WindowsAccent { get => Instance._windowsAccent; set => Instance._windowsAccent = value; }

private string _windowsAccentColor = "";
Expand Down Expand Up @@ -659,6 +658,7 @@ public static void WindowsAccent_Toggle()
WindowsAccentColor = "";
_ = AppData.ReloadPage();
}
SaveSettings();
}

[SupportedOSPlatform("windows")]
Expand All @@ -669,7 +669,8 @@ private static void SetAccentColor(bool userInvoked)
WindowsAccentColor = GetAccentColorHexString();
var (r, g, b) = GetAccentColor();
WindowsAccentColorHsl = FromRgb(r, g, b);


SaveSettings();
if (userInvoked)
_ = AppData.ReloadPage();
}
Expand Down
2 changes: 1 addition & 1 deletion TcNo-Acc-Switcher-Server/Shared/DynamicStylesheet.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public string GetStylesheetMarkupString()

var (h, s, l) = AppSettings.WindowsAccentColorHsl;
var (r, g, b) = AppSettings.WindowsAccentColorInt;
style = $":root {{ --accentHS: {h}, {s}%; --accentL: {l}%; --accent: {AppSettings.WindowsAccentColor}}}\n\n; --accentInt: {r}, {g}, {b}" + style;
style = $":root {{ --accentHS: {h}, {s}%; --accentL: {l}%; --accent: {AppSettings.WindowsAccentColor}; --accentInt: {r}, {g}, {b}}}\n\n; " + style;
}

if (AppSettings.Rtl)
Expand Down
2 changes: 1 addition & 1 deletion TcNo-Acc-Switcher-Server/themes/Monokai/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ button#LocateProgramExe,
#modalBtnBack:hover,
#btnRestore:hover,
#btnMax:hover {
background: var(--accent);
background: rgba(var(--accentInt), 50%);
}

.clearingRight {
Expand Down

0 comments on commit 93ec82b

Please sign in to comment.