sunatest / frontend /src /lib /utils /get-agent-style.ts
llama1's picture
Upload 781 files
5da4770 verified
import { getPixelDesignFromSeed } from '@/components/ui/pixel-avatar';
export const getAgentAvatar = (agentId: string) => {
const avatars = ['๐Ÿค–', '๐ŸŽฏ', 'โšก', '๐Ÿš€', '๐Ÿ”ฎ', '๐ŸŽจ', '๐Ÿ“Š', '๐Ÿ”ง', '๐Ÿ’ก', '๐ŸŒŸ'];
const colors = ['#06b6d4', '#22c55e', '#8b5cf6', '#3b82f6', '#ec4899', '#eab308', '#ef4444', '#6366f1'];
const avatarIndex = agentId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0) % avatars.length;
const colorIndex = agentId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0) % colors.length;
return {
avatar: avatars[avatarIndex],
color: colors[colorIndex]
};
};
export const getAgentPixelAvatar = (agentId: string) => {
const colors = ['#06b6d4', '#22c55e', '#8b5cf6', '#3b82f6', '#ec4899', '#eab308', '#ef4444', '#6366f1'];
const colorIndex = agentId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0) % colors.length;
const pixelDesign = getPixelDesignFromSeed(agentId);
return {
avatar: pixelDesign,
color: colors[colorIndex]
};
};