@php $cardTitle = theme_option('cookie_consent_title', trans('plugins/cookie-consent::cookie-consent.title')); $cardMessage = theme_option('cookie_consent_message', trans('plugins/cookie-consent::cookie-consent.message')); $learnMoreUrl = theme_option('cookie_consent_learn_more_url'); $learnMoreText = theme_option('cookie_consent_learn_more_text'); $hasCategories = ! empty($cookieConsentConfig['cookie_categories']); $primaryColor = theme_option('primary_color', '#f97316'); $primaryColorHover = theme_option('primary_color_hover', '#d66313'); // Pick the accept-all button text color (white vs near-black) that has the // highest WCAG contrast against the primary color, so the CTA stays legible // whatever brand color the store sets. White on a mid-tone brand color (e.g. // the default orange) only reaches ~2.9:1 and fails the AA 4.5:1 threshold. $accentTextColor = '#ffffff'; if (preg_match('/^#?([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/', $primaryColor)) { $hex = ltrim($primaryColor, '#'); if (strlen($hex) === 3) { $hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2]; } $toLinear = function ($channel) { $channel /= 255; return $channel <= 0.03928 ? $channel / 12.92 : pow(($channel + 0.055) / 1.055, 2.4); }; $luminance = 0.2126 * $toLinear(hexdec(substr($hex, 0, 2))) + 0.7152 * $toLinear(hexdec(substr($hex, 2, 2))) + 0.0722 * $toLinear(hexdec(substr($hex, 4, 2))); $contrastWhite = (1.0 + 0.05) / ($luminance + 0.05); $contrastBlack = ($luminance + 0.05) / 0.05; $accentTextColor = $contrastWhite >= $contrastBlack ? '#ffffff' : '#18181b'; } @endphp @include('plugins/cookie-consent::partials.scripts') @if ($hasCategories) @endif