feat:
This commit is contained in:
parent
e630df98a7
commit
cc1aa6f11f
@ -40,16 +40,15 @@ const getAvatarColour = (name: string) => {
|
|||||||
'#7F3BF5',
|
'#7F3BF5',
|
||||||
'#8F959E'
|
'#8F959E'
|
||||||
]
|
]
|
||||||
console.log(pinyin(name).charAt(0).toUpperCase().charCodeAt(0) - 65)
|
|
||||||
let charIndex = name
|
let charIndex = name
|
||||||
? pinyin(name).charAt(0).toUpperCase().charCodeAt(0) - 65 > 0
|
? pinyin(name).charAt(0).toUpperCase().charCodeAt(0) - 65 >= 0
|
||||||
? pinyin(name).charAt(0).toUpperCase().charCodeAt(0) - 65
|
? pinyin(name).charAt(0).toUpperCase().charCodeAt(0) - 65
|
||||||
: 0
|
: 0
|
||||||
: 0
|
: 0
|
||||||
|
|
||||||
function getColor() {
|
function getColor() {
|
||||||
if (!colours?.[charIndex]) {
|
if (!colours?.[charIndex]) {
|
||||||
charIndex -= 10
|
charIndex -= 11
|
||||||
getColor()
|
getColor()
|
||||||
}
|
}
|
||||||
return colours[charIndex]
|
return colours[charIndex]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user