-*). * Hex-Werte direkt im Code verboten (Kommentare werden ignoriert). * * Wir scannen .css- und .html-Files (für Inline-CSS). */ function check_css(string $dir, string $slug, Report $r): void { $publicDir = "$dir/public"; if (!is_dir($publicDir)) { $r->warn("public/ fehlt — CSS-Check übersprungen"); return; } $files = []; $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($publicDir, FilesystemIterator::SKIP_DOTS)); foreach ($rii as $file) { if (!$file->isFile()) continue; $ext = strtolower($file->getExtension()); if (in_array($ext, ['css', 'html'], true)) { $files[] = $file->getPathname(); } } $totalHex = 0; $violations = []; foreach ($files as $f) { $content = file_get_contents($f); // Multi-Line-Kommentare /* ... */ entfernen (auch über Zeilen hinweg) $content = preg_replace('/\/\*.*?\*\//s', '', $content); $rel = str_replace($dir . DIRECTORY_SEPARATOR, '', $f); $lines = preg_split('/\R/', $content); foreach ($lines as $ln => $line) { $trimmed = trim($line); // Kommentar-Zeilen überspringen if (str_starts_with($trimmed, '//') || str_starts_with($trimmed, '*') || str_starts_with($trimmed, '/*') || str_starts_with($trimmed, '