Accessing Theme Settings
Navigate to Personalización in the admin sidebar to access theme customization.The theme customization interface is located in
src/lib/components/admin/PersonalizacionTab.svelte.Color Palette
The theme system uses four primary color variables:Primary Color
Main brand color used in buttons, navigation, and key UI elements
Secondary Color
Accent color for call-to-action buttons and highlights
Accent Color
Alert and notification color for badges, errors, and warnings
Background Color
Base background color for landing page sections
Theme Editor Interface
The customization panel (src/lib/components/admin/PersonalizacionTab.svelte) provides an intuitive color picker interface:
Color Input Features
- Visual Picker
- Hex Input
- Preview Indicator
Large color swatch (56×56px) provides visual feedback and opens the browser’s native color picker on click.
Color Usage Guidelines
Primary Color
Where it’s used:- Admin sidebar background when tab is active
- Main navigation elements
- Primary action buttons
- Links and interactive elements
- Focus ring states
Secondary Color
Where it’s used:- Call-to-action buttons on public site
- Secondary UI accents
- Decorative elements
- Gradient backgrounds
Accent Color
Where it’s used:- Error messages and alerts
- Notification badges
- Warning indicators
- Delete buttons (hover state)
- Unread counts
Background Color
Where it’s used:- Main landing page background
- Section backgrounds on public site
- Base layer color
Saving Changes
Form Implementation
The theme form uses SvelteKit’s progressive enhancement:Why use:enhance?
Why use:enhance?
Progressive enhancement provides:
- No full page reload: Form submits via fetch
- Loading states: Button disables and shows “Guardando…”
- Automatic data sync: Page data updates after successful submission
- Graceful degradation: Works without JavaScript (full page reload)
Theme Synchronization
The theme state synchronizes with server data using Svelte 5’s reactive system:- Initial load shows current theme from database
- After save, theme updates to reflect what was saved
- Multiple tabs stay in sync (after refresh)
CSS Variable Application
Colors are applied as CSS custom properties in the root layout, making them available throughout the application:Tailwind Integration
Colors are also available as Tailwind utility classes:Visual Design
The theme customization panel features a polished UI:Card Layout
Card Layout
Each color is contained in a card with:
- Rounded corners (rounded-3xl)
- Light background (bg-[#F8FAFC])
- Subtle border (border-slate-50)
- Hover effect (shadow-lg on hover)
Descriptive Labels
Descriptive Labels
Each color includes:
- Bold label
- Usage description
- Visual preview indicator
Responsive Grid
Responsive Grid
2-column grid on medium+ screens, single column on mobile:
Best Practices
Contrast Ratio
Ensure sufficient contrast between text and background colors. Aim for WCAG AA compliance (4.5:1 for normal text).
Brand Consistency
Use colors from your brand guidelines. The theme system ensures consistency across all pages.
Test on Public Site
After saving, visit the public homepage to see your changes in context.
Document Choices
Keep a record of your hex codes for brand documentation and future reference.
Color Picker Tips
Database Storage
Theme colors are stored in the database and loaded on each page request, ensuring:- Persistence across sessions
- Consistency across all users
- Ability to revert by updating database directly if needed
Future Enhancements
Potential theme system expansions:- Color presets: Save and load complete color schemes
- Dark mode: Separate palette for dark theme
- Advanced colors: Additional accent colors, gradient stops
- Font customization: Typography settings
- Live preview: See changes without saving
- Color accessibility checker: Built-in contrast validation
