diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 0d1a12eef2..2353a3a019 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -27,11 +27,15 @@ namespace OpenRA.Widgets public Color ContrastColor = Color.Black; public bool WordWrap = false; public Func GetText; + public Func GetColor; + public Func GetContrastColor; public LabelWidget() : base() { GetText = () => Text; + GetColor = () => Color; + GetContrastColor = () => ContrastColor; } protected LabelWidget(LabelWidget other) @@ -45,6 +49,8 @@ namespace OpenRA.Widgets ContrastColor = other.ContrastColor; WordWrap = other.WordWrap; GetText = other.GetText; + GetColor = other.GetColor; + GetContrastColor = other.GetContrastColor; } public override void DrawInner() @@ -72,10 +78,12 @@ namespace OpenRA.Widgets if (WordWrap) text = WidgetUtils.WrapText(text, Bounds.Width, font); + var color = GetColor(); + var contrast = GetContrastColor(); if (Contrast) - font.DrawTextWithContrast(text, position, Color, ContrastColor, 2); + font.DrawTextWithContrast(text, position, color, contrast, 2); else - font.DrawText(text, position, Color); + font.DrawText(text, position, color); } public override Widget Clone() { return new LabelWidget(this); }