Compare commits

...

2 Commits

Author SHA1 Message Date
5d3a2c2222 Update TODO 2025-06-29 22:27:14 +02:00
e1e965796b Add proper inheritance for TextColor. 2025-06-29 22:24:54 +02:00
5 changed files with 5 additions and 6 deletions

View File

@@ -98,7 +98,7 @@
- Styling
- ~~Style sheet~~
- ~~Add style settings for UI panels (for buttons, labels, etc.).~~
- Parse StyleSheet from TOML file.
- ~~Parse StyleSheet from TOML file.~~
- Animated styles
- Find a way to reference external assets in the style (fonts, textures).
- Create a default style for widgets.

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()