@php $basePath = public_path('assets/img/mozartpp'); $defaultPath = $basePath . '/' . $picto . '.svg'; $svg = file_get_contents($defaultPath); $svg = str_replace('currentColor', $primaryHex, $svg); $primaryWithImportant = $primaryHex . ' !important'; $svg = preg_replace('/#D6BD85|#d6bd85|#D5B37D|#d5b37d/', $primaryWithImportant, $svg); $svg = preg_replace('/#94541C|#94541c/i', $primaryWithImportant, $svg); if (isset($faceColor)) { $svg = str_replace('#1F1F1F', $faceColor . ' !important', $svg); } $sourirePictos = ['content', 'satisfait', 'heureux']; if (in_array($picto, $sourirePictos, true)) { $svg = preg_replace('/fill\s*:\s*' . preg_quote($primaryHex, '/') . '\s*!important/', 'fill:none !important; stroke:' . $primaryHex . ' !important; stroke-width:1.2', $svg); } @endphp {!! $svg !!}