Add proper inheritance for TextColor.

This commit is contained in:
2025-06-29 22:24:54 +02:00
parent 207c8a20a4
commit e1e965796b
4 changed files with 4 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[Button]
BackgroundColor = "#0f62fe"
TextColor = "#37eb34"
TextColor = "#ffffff"
Padding = 16.0
# Creates an empty rule for Button.Normal.
@@ -29,7 +29,6 @@ BackgroundColor = "#750e13"
BackgroundColor = [0, 0, 0, 0]
BorderSize = 1.0
BorderColor = "#0f62fe"
TextColor = "#0353e9"
[Button.Outline.Normal]
TextColor = "#0353e9"

View File

@@ -19,7 +19,7 @@ public class Style
public Size BorderSize { get; set; }
public Color? BorderColor { get; set; }
public float CornerRadius { get; set; }
public Color TextColor { get; set; } = Color.White;
public Color? TextColor { get; set; }
}
public class StyleSheetLoader : ResourceLoader<StyleSheet>

View File

@@ -89,7 +89,7 @@ public class Button : Widget
}
_padding = style.Padding;
var textColor = style.TextColor;
var textColor = style.TextColor ?? Color.Black;
// renderer.SetTransform(GlobalPosition, Vector2.Zero);
// renderer.DrawRectangle(new Vector2(Size.Width, Size.Height), backgroundColor);

View File

@@ -55,7 +55,7 @@ public class Label : Widget
RenderStyleBox(renderer, style);
renderer.SetTransform(GlobalPosition, Vector2.Zero);
renderer.DrawText(_suitableFont, _text, style.TextColor);
renderer.DrawText(_suitableFont, _text, style.TextColor ?? Color.Black);
}
protected override void OnUpdate()