using UnityEngine;
using UnityEngine.UIElements;
using Ashwild.Inventory;
namespace Ashwild.EditorTools
{
///
/// Small library of styled VisualElement builders shared by the Ashwild Database editor views
/// (cards, type badges, accent colours). Centralised so the item and recipe editors stay visually
/// consistent and free of inline-style duplication.
///
public static class AshwildUI
{
#region Type Colours
///
/// The accent colour that identifies an item type across the list badges, hero and cards.
///
public static Color TypeColor(ItemType type)
{
switch (type)
{
case ItemType.Tool: return new Color(0.93f, 0.58f, 0.22f);
case ItemType.Weapon: return new Color(0.88f, 0.33f, 0.33f);
case ItemType.Consumable: return new Color(0.42f, 0.76f, 0.47f);
default: return new Color(0.47f, 0.57f, 0.69f);
}
}
#endregion
#region Builders
///
/// Builds a titled card container; callers add their fields straight onto the returned element,
/// below its heading.
///
public static VisualElement Card(string title)
{
VisualElement card = new VisualElement();
card.AddToClassList("ash-card");
Label heading = new Label(title);
heading.AddToClassList("ash-card__title");
card.Add(heading);
return card;
}
///
/// Builds a small rounded badge tinted by a colour — used for item-type tags. The background is
/// a translucent wash of the colour with the text in the solid colour for legibility on dark.
///
public static VisualElement Badge(string text, Color color)
{
Label badge = new Label(text);
badge.AddToClassList("ash-badge");
badge.style.color = color;
badge.style.backgroundColor = new Color(color.r, color.g, color.b, 0.16f);
return badge;
}
#endregion
}
}