opencs2-dataset-viewer / src /lib /utils /player-colors.ts
blanchon's picture
Nerfies-style home, paper-style match header, prettier setup, dataset README
95e3d2a
// Per-slot colors for the 10 player perspectives. Slot is stable across the
// match (player=0 is always the same person), so a slot-based palette gives
// each player a persistent visual identity even when sides switch at half.
//
// Palette is desaturated / earthier than a vivid Tailwind ramp — it borrows
// from CSGO HUD/comp tokens so 10 chips can sit next to each other without
// fighting the rest of the UI for attention.
export const PLAYER_COLORS = [
'#a73a3a', // 0 crimson
'#b4663b', // 1 rust
'#b29144', // 2 golden tan
'#7a8a40', // 3 olive
'#3f7878', // 4 teal
'#3f6796', // 5 dusk blue
'#6b5b95', // 6 dusty violet
'#9a5a7a', // 7 muted rose
'#638a64', // 8 sage
'#8c6f56' // 9 warm taupe
] as const;
export function playerColor(slot: number): string {
return PLAYER_COLORS[
((slot % PLAYER_COLORS.length) + PLAYER_COLORS.length) % PLAYER_COLORS.length
];
}