From 06095a56ac9644330f9b4a86eb6994541336a7cb Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Tue, 4 Nov 2025 22:43:35 +1000 Subject: [PATCH] node state text colour --- .../Features/TestExplorer/TestNodeEntry.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/SharpIDE.Godot/Features/TestExplorer/TestNodeEntry.cs b/src/SharpIDE.Godot/Features/TestExplorer/TestNodeEntry.cs index 66f6b3d..683f5fe 100644 --- a/src/SharpIDE.Godot/Features/TestExplorer/TestNodeEntry.cs +++ b/src/SharpIDE.Godot/Features/TestExplorer/TestNodeEntry.cs @@ -1,4 +1,5 @@ using Godot; +using SharpIDE.Application.Features.Testing.Client; using SharpIDE.Application.Features.Testing.Client.Dtos; namespace SharpIDE.Godot.Features.TestExplorer; @@ -9,6 +10,12 @@ public partial class TestNodeEntry : MarginContainer private Label _testNodeStatusLabel = null!; public TestNode TestNode { get; set; } = null!; + private static readonly Color SuccessTextColour = new Color("499c54"); + private static readonly Color RunningTextColour = new Color("a77fd2"); + private static readonly Color PendingTextColour = new Color("2aa9e7"); + private static readonly Color FailedTextColour = new Color("c65344"); + private static readonly Color CancelledTextColour = new Color("e4a631"); + private static readonly Color SkippedTextColour = new Color("c0c0c0"); public override void _Ready() { @@ -24,5 +31,21 @@ public partial class TestNodeEntry : MarginContainer if (TestNode == null) return; _testNameLabel.Text = TestNode.DisplayName; _testNodeStatusLabel.Text = TestNode.ExecutionState; + _testNodeStatusLabel.AddThemeColorOverride(ThemeStringNames.FontColor, GetTextColour(TestNode.ExecutionState)); + } + + private static Color GetTextColour(string executionState) + { + var colour = executionState switch + { + ExecutionStates.Passed => SuccessTextColour, + ExecutionStates.InProgress => RunningTextColour, + ExecutionStates.Discovered => PendingTextColour, + ExecutionStates.Failed => FailedTextColour, + ExecutionStates.Cancelled => CancelledTextColour, + ExecutionStates.Skipped => SkippedTextColour, + _ => Colors.White, + }; + return colour; } } \ No newline at end of file