diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f2969b8b..dfa00a2aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Bugfixes - [Core] Skip corrupted .acf files in Steam library (#4200 by: HebaruSan) +- [GUI] Fix label color blending (#4203 by: HebaruSan) ## v1.35.0 (Oberth) diff --git a/GUI/Model/ModList.cs b/GUI/Model/ModList.cs index 526582944..be46fbf74 100644 --- a/GUI/Model/ModList.cs +++ b/GUI/Model/ModList.cs @@ -392,6 +392,8 @@ public Color GetRowBackground(GUIMod mod, bool conflicted, string? instanceName, .Where(l => l.ContainsModule(game, mod.Identifier)) .Select(l => l.Color) .OfType() + // No transparent blending + .Where(c => c.A == byte.MaxValue) .ToArray()) : Color.Transparent; diff --git a/GUI/Util.cs b/GUI/Util.cs index 3f0cc74e6..1fb4790a7 100644 --- a/GUI/Util.cs +++ b/GUI/Util.cs @@ -288,7 +288,10 @@ public static Color BlendColors(Color[] colors) => colors.Length < 1 ? Color.Empty //: colors is [var c] ? c : colors.Length == 1 && colors[0] is var c ? c - : colors.Aggregate((back, fore) => fore.AlphaBlendWith(1f / colors.Length, back)); + : Color.FromArgb(colors.Sum(c => c.A) / colors.Length, + colors.Sum(c => c.R) / colors.Length, + colors.Sum(c => c.G) / colors.Length, + colors.Sum(c => c.B) / colors.Length); public static Color AlphaBlendWith(this Color c1, float alpha, Color c2) => AddColors(c1.MultiplyBy(alpha),