1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// a hand picked list of backgrounds that i think look pretty good on the user profile
const coolBackgrounds = [
'4.jpg',
'5.jpg',
'7.jpg',
'8.jpg',
'11.jpg',
'12.jpg',
'15.jpg',
'22.jpg',
'27.jpg',
'35.jpg',
'38.jpg',
'43.jpg',
'45.jpg',
'49.jpg',
'63.jpg',
'65.jpg',
'66.jpg',
'67.jpg',
'68.jpg',
'69.jpg',
'70.jpg',
'71.jpg',
]
/**
* Choose a background for the user based on their UUID.
* @param uuid The dashed or undashed UUID of the user.
* @returns The URL of the chosen background.
*/
export function chooseDefaultBackground(uuid: string): string {
// choose a background based on the user's uuid
const uuidNumber = parseInt(uuid.replace(/[^0-9]/g, ''), 16)
return '/backgrounds/' + coolBackgrounds[uuidNumber % coolBackgrounds.length]
}
|