fix: 应用icon颜色

This commit is contained in:
shaohuzhang1 2023-12-04 14:20:03 +08:00
parent 8726230a26
commit 42eacb5795

View File

@ -43,11 +43,7 @@ const getAvatarColour = (name: string) => {
let charIndex = name ? pinyin(name).charAt(0).toUpperCase().charCodeAt(0) - 65 : 0
function getColor() {
if (!colours[charIndex]) {
charIndex -= 10
getColor()
}
return colours[charIndex]
return colours[Math.abs(charIndex % colours.length)]
}
return getColor()