Web DevelopmentHugo
Dark Mode Support Added to the Site
· Vitor Pontual · 1 min read
Dark mode is now fully functional on the site! You can toggle between light and dark themes using the moon/sun button in the header navigation.
Implementation
The feature uses Tailwind CSS’s dark mode class strategy combined with JavaScript for theme persistence. Key features include:
- Toggle button in the header with moon/sun icons
- Persistent preference saved to localStorage
- System preference detection - respects your OS color scheme on first visit
- Smooth transitions between themes
- Comprehensive styling across all page types (posts, photos, projects)
The styling covers the entire site with appropriate dark: variants for backgrounds, text, links, and content cards. Your theme preference is remembered across page loads and sessions.