Add more color variations
This commit is contained in:
parent
3655d4d456
commit
d6fa339755
2 changed files with 152 additions and 14 deletions
24
constants.ts
24
constants.ts
|
|
@ -101,17 +101,13 @@ export const getPlayerRank = (playerId: string, players: Player[]): number => {
|
|||
return sorted.findIndex(p => p.id === playerId) + 1;
|
||||
};
|
||||
|
||||
export const PLAYER_COLORS = [
|
||||
'#2563eb',
|
||||
'#e21b3c',
|
||||
'#26890c',
|
||||
'#ffa602',
|
||||
'#d89e00',
|
||||
'#0aa3a3',
|
||||
'#b8008a',
|
||||
'#6a4c93',
|
||||
'#ff6b6b',
|
||||
'#4ecdc4',
|
||||
'#45b7d1',
|
||||
'#8b5cf6',
|
||||
];
|
||||
const GOLDEN_RATIO = 0.618033988749895;
|
||||
|
||||
export const generatePlayerColor = (index: number): string => {
|
||||
const hue = ((index * GOLDEN_RATIO) % 1) * 360;
|
||||
const saturation = 70 + (index % 3) * 10;
|
||||
const lightness = 45 + (index % 2) * 10;
|
||||
return `hsl(${Math.round(hue)}, ${saturation}%, ${lightness}%)`;
|
||||
};
|
||||
|
||||
export const PLAYER_COLORS = Array.from({ length: 50 }, (_, i) => generatePlayerColor(i));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue