@props(['initials'=>'..', 'colorSignature'=>'', 'size'=>'lg']) @php $avatarColors = [ 'bg-[#2C3E50]', // Dark blue-grey 'bg-[#34495E]', // Deep blue-grey 'bg-[#16A085]', // Dark teal 'bg-[#27AE60]', // Deep green 'bg-[#2980B9]', // Dark blue 'bg-[#8E44AD]', // Dark purple 'bg-[#E67E22]', // Dark orange 'bg-[#C0392B]', // Deep red 'bg-[#F39C12]', // Dark gold 'bg-[#7F8C8D]', // Dark grey ]; $colorSignature = empty($colorSignature) ? $initials : $colorSignature; $hash = crc32($colorSignature); $i = abs($hash) % count($avatarColors); $bg = $avatarColors[$i]; $sizes = [ 'sm'=>'size-10 min-w-10 min-h-10 text-sm font-bold', 'lg'=>'size-12 min-w-12 min-h-12 text-[1em] font-bold', 'xl'=>'size-20 min-w-20 min-h-20 text-3xl' ]; @endphp merge(['class' => 'inline-flex justify-center align-middle items-center text-white rounded-full '. $bg . ' ' . $sizes[$size] ]) }}>{{$initials}}