Theme System Overview
The theme customization system provides:- Live Color Editing: Change colors and see updates in real-time
- Database Persistence: Theme settings saved to PostgreSQL
- CSS Variable Integration: Colors injected as CSS custom properties
- Global Application: Changes apply site-wide automatically
- Visual Preview: See color samples before applying
Accessing Theme Customization
Color Options
Four primary color variables control the site appearance:1. Primary Color (Color Primario)
Usage: Main brand color used throughout the site Applied to:- Admin sidebar active state
- Primary buttons and CTAs
- Links and interactive elements
- Icons and accents
- Admin panel highlights
#0052A5 (Blue)
2. Secondary Color (Color Secundario)
Usage: Secondary brand color for action buttons Applied to:- Secondary call-to-action buttons
- Highlight elements
- Interactive components
- Badge backgrounds
#455dd9 (Purple-Blue)
3. Accent Color (Color de Acento)
Usage: Used for alerts, warnings, and important notices Applied to:- Error messages and alerts
- Warning indicators
- Notification badges
- Important highlights
- Unread counters
#E4002B (Red)
The accent color is typically used sparingly for elements that need immediate attention.
4. Background Color (Fondo de Landing)
Usage: Base background color for landing page sections Applied to:- Section backgrounds
- Page container backgrounds
- Content area bases
#F8FAFC (Light Gray)
Changing Theme Colors
Using the Color Picker
Select Color
Use the browser’s color picker to choose your desired color:
- Use the color wheel/slider
- Enter hex values manually
- Adjust hue, saturation, lightness
Using Hex Values
You can also enter hex color codes directly:- Manual Entry
- Common Formats
- Locate the hex input field below each color picker
- Click to edit the current value
- Enter your hex code (e.g.,
#FF5733) - Press Enter or click outside to apply
Color Theory Best Practices
Choosing Effective Colors
Brand Consistency
Brand Consistency
- Use colors from your existing brand guidelines
- Maintain consistency with logo colors
- Consider psychological impact of colors
- Test colors across different devices and screens
Contrast and Accessibility
Contrast and Accessibility
- Ensure sufficient contrast for text readability
- Test with WCAG contrast checker tools
- Aim for 4.5:1 contrast ratio minimum
- Consider colorblind users (avoid red/green reliance)
- Use tools like WebAIM Contrast Checker
Color Harmony
Color Harmony
Complementary: Colors opposite on color wheel
- Example: Blue (#0052A5) + Orange (#FF8C00)
- Example: Blue (#0052A5) + Teal (#0088A5)
- Example: Blue, Red, Yellow
Recommended Color Combinations
Professional Blue
- Primary:
#1565C0(Deep Blue) - Secondary:
#42A5F5(Light Blue) - Accent:
#F57C00(Orange) - Background:
#FAFAFA(Off-White)
Modern Green
- Primary:
#2E7D32(Forest Green) - Secondary:
#66BB6A(Light Green) - Accent:
#D32F2F(Red) - Background:
#F1F8E9(Light Green)
Elegant Purple
- Primary:
#6A1B9A(Deep Purple) - Secondary:
#AB47BC(Light Purple) - Accent:
#FFA000(Amber) - Background:
#F3E5F5(Pale Purple)
Corporate Gray
- Primary:
#424242(Dark Gray) - Secondary:
#757575(Medium Gray) - Accent:
#2196F3(Blue) - Background:
#FAFAFA(Off-White)
How Theme Colors Work
CSS Custom Properties
Theme colors are injected as CSS variables in the<head> of every page:
Tailwind Integration
Colors are available in Tailwind CSS classes:bg-primary- Background using primary colortext-primary- Text using primary colorborder-primary- Border using primary colorring-primary- Ring/outline using primary color
secondary, accent, and background.
Database Storage
Theme settings are stored in thetheme table:
| Column | Type | Description |
|---|---|---|
id | integer | Unique identifier |
primary | text | Primary color hex |
secondary | text | Secondary color hex |
accent | text | Accent color hex |
background | text | Background color hex |
updatedAt | timestamp | Last update time |
Previewing Changes
The admin panel provides visual feedback:Color Preview Indicators
Each color option shows:- Color Dot: Small circle displaying current color
- Hex Input: Editable hex value field
- Color Picker: Large clickable swatch
- Usage Description: Where the color is applied
Real-Time Updates
When editing colors:- Input changes update immediately in local state
- Preview shows color as you adjust
- Final save applies globally
Changes are only visible in your session until you click “Aplicar Cambios”.
Saving and Applying Changes
Save Process
When you click “Aplicar Cambios”:- Form submits to
?/updateThemeaction - Server validates color values
- Database updates with new colors
- Page reloads with updated theme
- CSS variables regenerate with new values
Reverting Changes
If you want to undo theme changes:Before Saving
- Simply reload the page to discard unsaved changes
- Or click a different sidebar item without saving
After Saving
Default Theme Colors
To restore the original PROVESA theme:Advanced Customization
Custom CSS Variables
For developers, you can add additional CSS variables:- Update the theme table schema to include new color fields
- Modify the theme injection logic in
src/routes/+layout.server.js - Add new color pickers in
PersonalizacionTab.svelte - Update Tailwind config to recognize new colors
Tailwind Configuration
Extend Tailwind to use theme colors intailwind.config.js:
Testing Your Theme
- Browser Testing
- Device Testing
- Accessibility Testing
Test your theme across browsers:
- Chrome/Edge (Chromium)
- Firefox
- Safari (if on Mac)
- Mobile browsers (iOS Safari, Chrome Mobile)
Troubleshooting
Colors not applying after save
Colors not applying after save
Solutions:
- Hard refresh the page (Ctrl+F5 or Cmd+Shift+R)
- Clear browser cache
- Check browser console for errors
- Verify database was updated (use Drizzle Studio)
Colors look different on mobile
Colors look different on mobile
Reasons:
- Mobile browsers may render colors differently
- Screen brightness and color temperature affect appearance
- Night mode or color filters may be enabled
- Test on actual devices when possible
- Adjust colors slightly to compensate
- Use web-safe colors when critical
Low contrast warning
Low contrast warning
Issue: Text hard to read on colored backgroundsSolutions:
- Use darker shades for text colors
- Lighten background colors
- Add text shadows or outlines
- Test with Contrast Checker
Best Practices Summary
- Test Before Committing: Try colors in the editor before applying
- Consider Accessibility: Ensure sufficient contrast ratios
- Brand Consistency: Align with existing brand guidelines
- Document Changes: Keep a record of color choices
- Mobile Testing: Verify appearance on small screens
- User Feedback: Gather opinions on color changes
Next Steps
Managing Content
Learn to update site content and images
Deployment
Deploy your customized site to production
