@php $primaryColor = \App\Models\Setting::get('primary_color', '#EAB308'); $backgroundColor = \App\Models\Setting::get('background_color', '#f3f4f6'); $backgroundColor2 = \App\Models\Setting::get('background_color_2', $backgroundColor); // Helper to calculate contrast (YIQ) if (!function_exists('isDarkColor')) { function isDarkColor($hexColor) { $hexColor = ltrim($hexColor, '#'); if (strlen($hexColor) == 3) { $hexColor = $hexColor[0].$hexColor[0].$hexColor[1].$hexColor[1].$hexColor[2].$hexColor[2]; } $r = hexdec(substr($hexColor, 0, 2)); $g = hexdec(substr($hexColor, 2, 2)); $b = hexdec(substr($hexColor, 4, 2)); $yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000; return ($yiq < 128); } } // Helper to adjust brightness if (!function_exists('adjustBrightnessColor')) { function adjustBrightnessColor($hexColor, $steps) { $hexColor = ltrim($hexColor, '#'); if (strlen($hexColor) == 3) { $hexColor = $hexColor[0].$hexColor[0].$hexColor[1].$hexColor[1].$hexColor[2].$hexColor[2]; } $r = hexdec(substr($hexColor, 0, 2)); $g = hexdec(substr($hexColor, 2, 2)); $b = hexdec(substr($hexColor, 4, 2)); $r = max(0, min(255, $r + $steps)); $g = max(0, min(255, $g + $steps)); $b = max(0, min(255, $b + $steps)); return '#' . str_pad(dechex($r), 2, '0', STR_PAD_LEFT) . str_pad(dechex($g), 2, '0', STR_PAD_LEFT) . str_pad(dechex($b), 2, '0', STR_PAD_LEFT); } } $isBgDark = isDarkColor($backgroundColor); $textColor = $isBgDark ? '#f9fafb' : '#1f2937'; $mutedTextColor = $isBgDark ? '#9ca3af' : '#4b5563'; $cardColor = $isBgDark ? adjustBrightnessColor($backgroundColor, 20) : '#ffffff'; $borderColor = $isBgDark ? adjustBrightnessColor($backgroundColor, 30) : '#e5e7eb'; $isPrimaryDark = isDarkColor($primaryColor); $primaryTextColor = $isPrimaryDark ? '#ffffff' : '#1f2937'; $primaryHover = adjustBrightnessColor($primaryColor, -20); // Footer colors based on bottom background color $isBg2Dark = isDarkColor($backgroundColor2); $footerTextColor = $isBg2Dark ? '#9ca3af' : '#4b5563'; $footerBorderColor = $isBg2Dark ? adjustBrightnessColor($backgroundColor2, 30) : '#e5e7eb'; // Cart Count Logic $cartCount = 0; if (\Illuminate\Support\Facades\Auth::check()) { $cartCount = \App\Models\Cart::where('user_id', \Illuminate\Support\Facades\Auth::id())->sum('quantity'); } else { $cartCount = \App\Models\Cart::where('session_id', \Illuminate\Support\Facades\Session::getId())->sum('quantity'); } @endphp @php $currentAnimation = \App\Models\Setting::get('site_animation', 'none'); @endphp @if($currentAnimation === 'meteor') @elseif($currentAnimation === 'gold_dust') @elseif($currentAnimation === 'ecommerce') @elseif($currentAnimation === 'muslimah') @elseif($currentAnimation === 'sports') @endif @if($currentAnimation === 'meteor')
@elseif($currentAnimation === 'gold_dust')
@elseif($currentAnimation === 'ecommerce')
@elseif($currentAnimation === 'muslimah')
@elseif($currentAnimation === 'sports')
@endif
@if(session('success')) @endif @if(session('error')) @endif @yield('content')