diff --git a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs index d1ea904049..23945801e4 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowerTimerWidget.cs @@ -9,9 +9,11 @@ */ #endregion +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; +using OpenRA.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Primitives; using OpenRA.Widgets; @@ -26,7 +28,7 @@ namespace OpenRA.Mods.Common.Widgets readonly int timestep; readonly IEnumerable powers; - Pair[] texts; + Tuple[] texts; [ObjectCreator.UseCtor] public SupportPowerTimerWidget(World world) @@ -56,7 +58,11 @@ namespace OpenRA.Mods.Common.Widgets var color = !p.Ready || Game.LocalTick % 50 < 25 ? playerColor : Color.White; - return Pair.New(text, color); + var inversedColor = self.Owner.Color; + var inversedL = color == Color.White || inversedColor.L > 128 ? (byte)0 : (byte)255; + inversedColor = new HSLColor(inversedColor.H, 0, inversedL); + + return Tuple.Create(text, color, inversedColor.RGB); }).ToArray(); } @@ -69,8 +75,8 @@ namespace OpenRA.Mods.Common.Widgets foreach (var t in texts) { var font = Game.Renderer.Fonts[Font]; - font.DrawTextWithContrast(t.First, new float2(Bounds.Location) + new float2(0, y), t.Second, Color.Black, 1); - y += (font.Measure(t.First).Y + 5) * (int)Order; + font.DrawTextWithContrast(t.Item1, new float2(Bounds.Location) + new float2(0, y), t.Item2, t.Item3, 1); + y += (font.Measure(t.Item1).Y + 5) * (int)Order; } }