Add Text Color Highlighted on Dropdown

This commit is contained in:
Phantom
2025-12-07 16:53:43 +01:00
parent a1999183f2
commit 56278b17ee

View File

@@ -303,6 +303,12 @@ namespace FlaxEngine.GUI
[EditorDisplay("Text Style"), EditorOrder(2023), ExpandGroups]
public Color TextColor { get; set; }
/// <summary>
/// Gets or sets the color used to display highlighted text.
/// </summary>
[EditorDisplay("Text Style"), EditorOrder(2023), ExpandGroups]
public Color TextColorHighlighted { get; set; }
/// <summary>
/// Gets or sets the horizontal text alignment within the control bounds.
/// </summary>
@@ -386,6 +392,7 @@ namespace FlaxEngine.GUI
var style = Style.Current;
Font = new FontReference(style.FontMedium);
TextColor = style.Foreground;
TextColorHighlighted = style.Foreground;
BackgroundColor = style.BackgroundNormal;
BackgroundColorHighlighted = BackgroundColor;
BackgroundColorSelected = BackgroundColor;
@@ -749,7 +756,7 @@ namespace FlaxEngine.GUI
// Draw text of the selected item
var textRect = new Rectangle(margin, 0, clientRect.Width - boxSize - 2.0f * margin, clientRect.Height);
Render2D.PushClip(textRect);
var textColor = TextColor;
var textColor = (IsMouseOver || IsNavFocused) ? TextColorHighlighted : TextColor;
string text = _items[_selectedIndex];
string format = TextFormat != null ? TextFormat : null;
if (!string.IsNullOrEmpty(format))