#!/usr/bin/env python3 """ Color Fix Script for AI Learning Path Generator Automatically replaces white backgrounds and bright colors with dark glassmorphic theme """ import os import shutil from pathlib import Path def backup_file(filepath): """Create a backup of the original file""" backup_path = f"{filepath}.backup" shutil.copy2(filepath, backup_path) print(f"ā Backup created: {backup_path}") return backup_path def fix_colors(filepath): """Apply color fixes to the template file""" print(f"\nšØ Fixing colors in: {filepath}") # Read the file with open(filepath, 'r', encoding='utf-8') as f: content = f.read() # Track changes changes = 0 # 1. Replace white backgrounds with glass-card replacements = [ ('bg-white rounded-xl shadow-xl', 'glass-card'), ('bg-white rounded-lg shadow-xl', 'glass-card'), ('bg-white rounded-lg shadow-md', 'glass-card'), ('bg-white rounded-lg shadow', 'glass-card'), ('bg-white p-4 rounded-lg shadow', 'glass-card p-4'), ('bg-white p-8 rounded-xl', 'glass-card p-8'), ('bg-gray-100', 'glass-card'), ('bg-gray-50', 'glass-card'), ('bg-gray-200', 'glass-card'), ] for old, new in replacements: count = content.count(old) if count > 0: content = content.replace(old, new) changes += count print(f" ā Replaced '{old}' ā '{new}' ({count} times)") # 2. Replace text colors text_replacements = [ ('text-gray-900', 'text-white'), ('text-gray-800', 'text-white'), ('text-gray-700', 'text-secondary'), ('text-gray-600', 'text-secondary'), ('text-gray-500', 'text-muted'), ('text-magenta', 'text-neon-purple'), ] border_replacements = [ ('border-gray-200', 'border-transparent'), ('border-gray-300', 'border-glass'), ] for old, new in text_replacements: count = content.count(old) if count > 0: content = content.replace(old, new) changes += count print(f" ā Replaced '{old}' ā '{new}' ({count} times)") for old, new in border_replacements: count = content.count(old) if count > 0: content = content.replace(old, new) changes += count print(f" ā Replaced '{old}' ā '{new}' ({count} times)") # 3. Fix specific sections specific_fixes = [ # Learning Journey title ('