From 61e4933e915a269114221f9962e92d4b6cf92e33 Mon Sep 17 00:00:00 2001 From: Reabstraction Date: Fri, 28 Jul 2023 17:31:58 +0200 Subject: [PATCH] Changed BGR coloring to RGB --- MicaForEveryone.Core/Models/TargetWindow.cs | 16 +++++++++++++--- MicaForEveryone.UI/Strings/en/Resources.resw | 6 +++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/MicaForEveryone.Core/Models/TargetWindow.cs b/MicaForEveryone.Core/Models/TargetWindow.cs index e31c87d5..7321f4fd 100644 --- a/MicaForEveryone.Core/Models/TargetWindow.cs +++ b/MicaForEveryone.Core/Models/TargetWindow.cs @@ -111,6 +111,16 @@ public void ApplyBorderColorRule(COLORREF borderColor) DesktopWindowManager.SetBorderColor(WindowHandle, borderColor); } + private static UInt32 HexToColorRef(string? value) + { + if (value == null) + return 0; + + var rgb = Convert.ToUInt32(value, 16); + var bgr = ((rgb & 0xFF) << 16) | (rgb & 0xFF00) | ((rgb >> 16) & 0xFF); + return bgr; + } + public void ApplyRule(IRule rule, TitlebarColorMode systemTitlebarColorMode) { #if DEBUG @@ -123,7 +133,7 @@ public void ApplyRule(IRule rule, TitlebarColorMode systemTitlebarColorMode) { try { - ApplyCaptionColorRule(Convert.ToUInt32(rule.CaptionColor, 16)); + ApplyCaptionColorRule(HexToColorRef(rule.CaptionColor)); } catch (FormatException) { @@ -136,7 +146,7 @@ public void ApplyRule(IRule rule, TitlebarColorMode systemTitlebarColorMode) { try { - ApplyCaptionTextColorRule(Convert.ToUInt32(rule.CaptionTextColor, 16)); + ApplyCaptionTextColorRule(HexToColorRef(rule.CaptionTextColor)); } catch (FormatException) { @@ -148,7 +158,7 @@ public void ApplyRule(IRule rule, TitlebarColorMode systemTitlebarColorMode) { try { - ApplyBorderColorRule(Convert.ToUInt32(rule.BorderColor, 16)); + ApplyBorderColorRule(HexToColorRef(rule.BorderColor)); } catch (FormatException) { diff --git a/MicaForEveryone.UI/Strings/en/Resources.resw b/MicaForEveryone.UI/Strings/en/Resources.resw index 567ef08d..16c6edb2 100644 --- a/MicaForEveryone.UI/Strings/en/Resources.resw +++ b/MicaForEveryone.UI/Strings/en/Resources.resw @@ -433,21 +433,21 @@ Fix errors then use "Reload config file" option to reload it. Exit - Color in BBGGRR hex string, empty for default + Color in RRGGBB hex string, empty for default requires build 22000+ Window Border Color - Color in BBGGRR hex string, empty for default + Color in RRGGBB hex string, empty for default requires build 22000+ TitleBar Color - Color in BBGGRR hex string, empty for default + Color in RRGGBB hex string, empty for default requires build 22000+