add accent color strip to search item icons

This commit is contained in:
xxSeys1
2025-06-23 20:14:18 +02:00
parent 6c1e380a3e
commit 109d4423bb

View File

@@ -20,6 +20,11 @@ namespace FlaxEditor.Windows.Search
/// </summary>
protected Image _icon;
/// <summary>
/// The color of the accent strip.
/// </summary>
protected Color _accentColor;
/// <summary>
/// The item name.
/// </summary>
@@ -56,7 +61,7 @@ namespace FlaxEditor.Windows.Search
var icon = new Image
{
Size = new Float2(logoSize),
Location = new Float2(5, (height - logoSize) / 2)
Location = new Float2(7, (height - logoSize) / 2)
};
_icon = icon;
@@ -146,6 +151,7 @@ namespace FlaxEditor.Windows.Search
{
_asset = item;
_asset.AddReference(this);
_accentColor = Editor.Instance.ContentDatabase.GetProxy(item).AccentColor;
}
/// <inheritdoc />
@@ -228,6 +234,10 @@ namespace FlaxEditor.Windows.Search
// Draw icon
var iconRect = _icon.Bounds;
_asset.DrawThumbnail(ref iconRect);
// Draw icon color strip
var rect = iconRect with { Width = 2, Height = Height, Location = Float2.Zero };
Render2D.FillRectangle(rect, _accentColor);
}
/// <inheritdoc />