@noya-app/noya-multiplayer-react 0.1.43 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,82 +0,0 @@
1
- function hashCode(string: string) {
2
- let hash = 0;
3
-
4
- for (const char of string) {
5
- hash = char.charCodeAt(0) + ((hash << 5) - hash);
6
- }
7
-
8
- return hash;
9
- }
10
-
11
- function elementFromHash<T>(array: T[], hash: number): T {
12
- return array[Math.abs(hash) % array.length];
13
- }
14
-
15
- export function getAvatarInitials(name: string) {
16
- return name
17
- .split(" ")
18
- .filter((c) => c.length > 0)
19
- .map((c) => c[0])
20
- .join("")
21
- .toLocaleUpperCase();
22
- }
23
-
24
- /**
25
- * Create a background color and initials from a name
26
- *
27
- * Adapted from https://mui.com/material-ui/react-avatar/
28
- */
29
- export function getAvatarStyle(name: string) {
30
- const hash = hashCode(name);
31
- const color = elementFromHash(Object.values(colors500), hash);
32
- // const darkerColor = elementFromHash(Object.values(colors800), hash);
33
-
34
- return {
35
- color: "white",
36
- backgroundColor: color,
37
- // primaryColors: {
38
- // "500": color,
39
- // "800": darkerColor,
40
- // },
41
- };
42
- }
43
-
44
- const colors500 = {
45
- red500: "#ef4444",
46
- orange500: "#f97316",
47
- amber500: "#f59e0b",
48
- yellow500: "#eab308",
49
- lime500: "#84cc16",
50
- green500: "#22c55e",
51
- emerald500: "#10b981",
52
- teal500: "#14b8a6",
53
- cyan500: "#06b6d4",
54
- sky500: "#0ea5e9",
55
- blue500: "#3b82f6",
56
- indigo500: "#6366f1",
57
- violet500: "#8b5cf6",
58
- purple500: "#a855f7",
59
- fuchsia500: "#d946ef",
60
- pink500: "#ec4899",
61
- rose500: "#f43f5e",
62
- };
63
-
64
- // const colors800 = {
65
- // red800: "#991b1b",
66
- // orange800: "#9a3412",
67
- // amber800: "#92400e",
68
- // yellow800: "#854d0e",
69
- // lime800: "#3f6212",
70
- // green800: "#166534",
71
- // emerald800: "#065f46",
72
- // teal800: "#115e59",
73
- // cyan800: "#155e75",
74
- // sky800: "#075985",
75
- // blue800: "#1e40af",
76
- // indigo800: "#3730a3",
77
- // violet800: "#5b21b6",
78
- // purple800: "#6b21a8",
79
- // fuchsia800: "#86198f",
80
- // pink800: "#9d174d",
81
- // rose800: "#9f1239",
82
- // };