This commit is contained in:
hailin 2025-03-15 21:36:12 +08:00
parent 4158487cb5
commit 2cff032f7f
1 changed files with 1 additions and 1 deletions

View File

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