Static utility providing a slot-indexed color palette for players. It stores an array of Color values and exposes GetColor(slotIndex) which returns a color with wraparound, plus a Count property for palette size.
namespace Machines.Player;
/// <summary>
/// Slot-indexed colour palette for players.
/// </summary>
public static class PlayerColors
{
private static Color[] Palette =>
[
"#E63946", // Slot 0: Red
"#457B9D", // Slot 1: Blue
"#2A9D8F", // Slot 2: Green
"#7B2D8B", // Slot 3: Purple
"#F4A261", // Slot 4: Orange
"#E056A0", // Slot 5: Pink
"#48BFE3", // Slot 6: Cyan
"#FFEE58", // Slot 7: Yellow
];
/// <summary>
/// Returns the colour for a given slot index, wrapping if beyond palette size.
/// </summary>
public static Color GetColor( int slotIndex )
{
if ( Palette.Length == 0 )
return Color.White;
return Palette[slotIndex % Palette.Length];
}
/// <summary>
/// Number of colours in the palette.
/// </summary>
public static int Count => Palette.Length;
}