export const AVATAR_CORES = [ "bg-blue-500", "bg-violet-500", "bg-emerald-500", "bg-amber-500", "bg-rose-500", "bg-cyan-500", "bg-indigo-500", ]; export function avatarIniciais(nome) { const n = String(nome || "?").trim(); const partes = n.split(/\s+/); if (partes.length >= 2) return (partes[0][0] + partes[1][0]).toUpperCase(); return n.slice(0, 2).toUpperCase(); } export function avatarCor(nome) { let hash = 0; for (const c of String(nome || "")) hash = (hash * 31 + c.charCodeAt(0)) & 0xffffffff; return AVATAR_CORES[Math.abs(hash) % AVATAR_CORES.length]; }