Code/Demos/TarkovInventory/StashTheme.cs
using Goo;
using Sandbox;
using Sandbox.UI;
namespace Sandbox.TarkovInventory;
// visual tokens and tile geometry shared by TarkovStashUI, StashTileBlob, and SplitModalBlob via `using static`; demo-local, not a Goo brand token.
internal static class StashTheme
{
public const float SlotSize = 88f;
public const float EquipSlotSize = 96f; // compact paper-doll equip slot square
public static readonly Color GridBg = new( 0.07f, 0.07f, 0.09f, 0.96f );
public static readonly Color CellBg = new( 1f, 1f, 1f, 0.04f );
public static readonly Color OkTint = new( 0.30f, 0.90f, 0.45f, 0.40f );
public static readonly Color BadTint = new( 0.95f, 0.30f, 0.30f, 0.40f );
public static readonly Color MergeTint = new( 0.30f, 0.75f, 0.95f, 0.45f ); // cyan: drop will stack onto this cell
public static readonly Color Backdrop = new( 0f, 0f, 0f, 0.55f );
public static readonly Color Title = new( 0.92f, 0.92f, 0.96f, 1f );
public static readonly Color Faint = new( 1f, 1f, 1f, 0.55f );
public static readonly Color ItemBdr = new( 1f, 1f, 1f, 0.22f );
public static readonly Color SlotBg = new( 1f, 1f, 1f, 0.05f ); // empty equip slot
public static readonly Color BtnOff = new( 0.30f, 0.30f, 0.34f, 1f ); // Cancel button
public static readonly Color BtnGrey = new( 0.22f, 0.22f, 0.26f, 1f ); // disabled Split button
public const string IconTint = "#e8e8f0";
public const float IconPad = 6f;
// mono face for a tactical inventory look; not a stock UI default (same Google-font-by-name path as the other demos).
public const string LabelFont = "Space Mono";
// Reserved height for the name and amount rows when sizing the middle glyph of a three-row tile.
public const float RowH = 22f;
// Icon fills the tile's SHORTER axis (square, minus padding) so multi-cell items read at full
// size without distorting the square SVG art - independent of how the engine scales the glyph.
public static float IconSide( GridRect rect )
{
int min = rect.W < rect.H ? rect.W : rect.H;
return min * SlotSize - 2f * IconPad;
}
// Square glyph for the three-row tile: the middle space (tile height minus the two text rows), capped to width.
public static float IconRowSide( GridRect rect )
{
float byW = rect.W * SlotSize - 2f * IconPad;
float byH = rect.H * SlotSize - 2f * RowH;
return byW < byH ? byW : byH;
}
// Natural footprint, swapped when rotated 90 degrees.
public static (int w, int h) Eff( StashItem item, bool rotated ) => rotated ? (item.H, item.W) : (item.W, item.H);
// per-type solid tile tint; solid stand-in for per-type gradients (Goo BackgroundImage is Texture?; no typed gradient primitive yet).
public static Color KindTint( ItemKind kind ) => kind switch
{
ItemKind.Gem => new( 0.13f, 0.30f, 0.34f, 1f ), // teal
ItemKind.Helmet => new( 0.34f, 0.27f, 0.12f, 1f ), // amber
ItemKind.Rifle => new( 0.34f, 0.15f, 0.16f, 1f ), // crimson
ItemKind.Magazine => new( 0.20f, 0.18f, 0.34f, 1f ), // indigo
_ => new( 0.20f, 0.22f, 0.28f, 1f ),
};
}