From ef83124cfa31c73d2a56600582934c35538bc25d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 22 Jun 2021 01:14:06 +0200 Subject: [PATCH] allow changing the color of panels --- MLEM.Ui/Elements/Panel.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index b6c23ca..666268a 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -22,6 +22,11 @@ namespace MLEM.Ui.Elements { /// public StyleProp Texture; /// + /// The color that this panel's should be drawn with. + /// If this style property has no value, is used. + /// + public StyleProp DrawColor; + /// /// The scroll bar that this panel contains. /// This is only nonnull if is true. /// @@ -154,7 +159,7 @@ namespace MLEM.Ui.Elements { /// public override void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) { if (this.Texture.HasValue()) - batch.Draw(this.Texture, this.DisplayArea, Color.White * alpha, this.Scale); + batch.Draw(this.Texture, this.DisplayArea, this.DrawColor.OrDefault(Color.White) * alpha, this.Scale); // if we handle overflow, draw using the render target in DrawUnbound if (!this.scrollOverflow || this.renderTarget == null) { base.Draw(time, batch, alpha, blendState, samplerState, matrix);