Overview
Taskflow includes a fully-featured dark mode that transforms the entire interface with a carefully designed color palette. User theme preferences are automatically saved and restored across sessions.Theme Toggle Function
TheaplicarTema() function handles theme switching and persistence:
app.js
- Toggles the
darkclass on the root HTML element - Updates the theme button icon (moon for dark, sun for light)
- Saves the preference to localStorage
Tailwind CSS’s
dark: variant system automatically applies dark mode styles when the dark class is present on the document element.Loading Saved Theme
On page load, the application restores the user’s previous theme preference:app.js
If no theme preference is saved, the application defaults to light mode.
Toggle Button
The theme toggle button is positioned in the header with a clean, accessible design:index.html
- Absolute positioning in the header
- Different background colors for light and dark modes
- Smooth hover transitions
- Icon that changes based on current theme
Toggle Event Listener
Clicking the button toggles between themes:app.js
Tailwind Dark Mode Configuration
Dark mode is enabled using Tailwind’s class-based strategy:tailwind.config.js
Dark Mode Styles
Body Background
The main body adapts its background and text color:index.html
Header
index.html
Sidebar
index.html
Form Inputs
index.html
Custom CSS Dark Mode Rules
Task cards also include dark mode styling:input.css
Color Palette
Light Mode
- Background:
#f3f4f6(gray-100) - Cards:
#ffffff(white) - Text:
#1f2937(gray-800) - Borders:
#e5e7eb(gray-200)
Dark Mode
- Background:
#1a1a2e(dark navy) - Cards:
#243656(midnight blue) - Text:
#ffffff(white) - Borders:
#2a4a7f(muted blue) - Hover:
#0f3460(deep blue)
All colors include smooth transitions for a polished theme-switching experience.
LocalStorage Persistence
The theme preference is stored with the keytema:
'dark'- Dark mode enabled'light'- Light mode enabled (or null for default)
Related Features
- Local Storage - How preferences are persisted
- Priority System - Priority colors adapt to theme
- Task Management - All task UI elements support dark mode