move name coloring out of sender profile
so we can reuse it in room preview bar
This commit is contained in:
parent
56ade1ead5
commit
eeaa7143ac
4 changed files with 43 additions and 36 deletions
|
@ -58,3 +58,8 @@ export function hashCode(str) {
|
|||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
||||
export function getUserNameColorClass(userId) {
|
||||
const colorNumber = (hashCode(userId) % 8) + 1;
|
||||
return `mx_Username_color${colorNumber}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue