@php
    $side = $side ?? 48;

        $colors = [
            "#00AA55",
            "#009FD4",
            "#B381B3",
            "#939393",
            "#E3BC00",
            "#D47500",
            "#DC2A2A",
            "#3ede91",
            "#377dd4",
            "#0256b0",
            "#053d82",
            "#3d026e",
            "#b378e3",
            "#c4065c",
            "#543208",
            "#d97811",
            "#0c6b40",
        ];
        $initials = function($name){
            $segs = explode(" ",$name);
            if(count($segs) > 1){
                return strtoupper($segs[0][0]).strtoupper($segs[1][0]);
            }
            return strtoupper($segs[0][0]).strtoupper($segs[0][1]);
        };

        $name = $user["name"];
        $charIndex = ord($name[1]) + strlen($name);
        $colorIndex = $charIndex % 19;
        $bgColor = $colors[$colorIndex];
@endphp

<div
        class="avatar"
        title="{{$name}}"
        style="background-color:{{$bgColor}};height: {{$side}}px;width: {{$side}}px; font-size:{{$side / 2}}px"
>
    <div class="avatar__letters">{{$initials($user["name"])}}</div>
</div>