This commit is contained in:
parent
4158487cb5
commit
2cff032f7f
|
|
@ -39,7 +39,7 @@ export function UserMenu({ user }: { user: UserData }) {
|
|||
|
||||
const router = useRouter()
|
||||
|
||||
const getRandomColor = (name) => {
|
||||
const getRandomColor = (name: string | undefined): string => {
|
||||
if (!name) return "#999"; // 默认颜色
|
||||
const colors = ["#FF5733", "#33FF57", "#3357FF", "#FF33A8", "#FFC300", "#FF5733", "#57FF33", "#A833FF"];
|
||||
const index = name.charCodeAt(0) % colors.length; // 根据名字的首字母选择颜色
|
||||
|
|
|
|||
Loading…
Reference in New Issue