diff --git a/application/Espo/EntryPoints/Avatar.php b/application/Espo/EntryPoints/Avatar.php index 26424b34aa..3ec01aab89 100644 --- a/application/Espo/EntryPoints/Avatar.php +++ b/application/Espo/EntryPoints/Avatar.php @@ -75,10 +75,14 @@ class Avatar extends Image implements Di\MetadataAware $sum += ord($hash[$i]); } - $x = intval($sum % 128) + 1; + $x = $sum % 128 + 1; $colorList = $this->metadata->get(['app', 'avatars', 'colorList']) ?? $this->colorList; + if ($x === 128) { + $x--; + } + $index = intval($x * count($colorList) / 128); return $colorList[$index];