Benefits of Dark Mode
Reduced Eye Strain
Dark mode is easier on your eyes during night driving or in low-light conditions.
Better Battery Life
On OLED and AMOLED screens, dark mode can significantly extend battery life.
Night Driving Safety
Reduces screen glare at night, helping you maintain better focus on the road.
Personal Preference
Some users simply prefer the aesthetics of dark interfaces.
Enabling Dark Mode
You can toggle dark mode on or off at any time:Access Settings or Toggle
The dark mode toggle is typically located in:
- The main settings screen
- The sidebar menu
- The app header or toolbar
Toggle Dark Mode
Tap the toggle switch to enable or disable dark mode:
- ON: Dark theme is applied immediately
- OFF: Light theme is restored
How Dark Mode Works
The dark mode implementation in Rodando uses a simple but effective approach:Theme Application
Fromapp.component.ts:64-69, the theme toggle works as follows:
- CSS Class Toggle: Adds or removes the
darkclass from<body> - State Update: Updates the component’s
isDarkThemeproperty - Persistence: Saves your preference as
'true'or'false'in localStorage
CSS Implementation
The app uses CSS custom properties (variables) that change based on thedark class:
Preference Storage
Your dark mode preference is stored in the browser’s localStorage:Storage Key
- Key:
'dark-mode' - Value:
'true'or'false'(stored as string) - Scope: Persists across app sessions until cleared
Loading Saved Preference
When you open the app, your saved preference is loaded automatically. Fromapp.component.ts:17-45:
If no preference is saved (first app launch), the app defaults to light mode.
System Preference Detection
The app can also detect your device’s system-level dark mode preference:Automatic Theme Matching
Fromapp.component.ts:46-60:
How It Works
Check for Manual Preference
The app first checks if you’ve manually set a dark mode preference in the app.
Use System Preference (If No Manual Setting)
If you haven’t set a preference, the app respects your device’s system setting:
- Device in dark mode → App uses dark theme
- Device in light mode → App uses light theme
Dark Mode and UI Components
When dark mode is enabled, all major UI components adapt:Affected Elements
Navigation and Sidebar
Navigation and Sidebar
Cards and Modals
Cards and Modals
- Dark card backgrounds
- Lighter borders for definition
- Adjusted shadow for depth perception
- High contrast text for readability
Buttons and Inputs
Buttons and Inputs
Maps and Graphics
Maps and Graphics
- Map styles switch to dark variants
- Route lines remain highly visible
- Markers and pins use high-contrast colors
- Reduced brightness on map background
Trip Assignment Modal
Trip Assignment Modal
When you receive a trip offer in dark mode:
- Modal background is dark
- Trip details are clearly legible
- Countdown timer remains prominent
- Accept/Decline buttons maintain clear contrast
Best Practices
Use at Night
Enable dark mode when driving at night to reduce screen glare and eye strain.
Save Battery
If you have an OLED device, dark mode can extend battery life by up to 30%.
Brightness Adjustment
Combine dark mode with reduced screen brightness for maximum eye comfort.
Personal Comfort
Choose whichever theme is most comfortable for your eyes, regardless of time of day.
Technical Details
Implementation Architecture
- Component Level:
AppComponentmanages the theme state - DOM Manipulation: Adds/removes
darkclass on<body> - CSS Variables: Global theme properties cascade to all components
- LocalStorage: Persists preference across sessions
- Platform Ready: Waits for Ionic platform initialization before applying theme
Toggle Component
The toggle likely uses an Ionic toggle component:isDarkTheme: Boolean bound to toggle statetoggleDarkTheme($event): Handler that updates theme and storage
State Synchronization
TheisDarkTheme property stays synchronized with:
- The toggle UI state
- The
darkclass on<body> - The localStorage value
Clearing Dark Mode Preference
To reset to system default:On mobile devices, you typically can’t manually clear localStorage. The app would need a “Reset to System Default” option for this.
Troubleshooting
Dark mode toggle doesn't work
Dark mode toggle doesn't work
If toggling has no effect:
- Check if the toggle is properly bound to
toggleDarkTheme() - Verify localStorage is accessible (not blocked by browser)
- Ensure CSS classes are defined in your stylesheets
- Try clearing app cache and reloading
Theme doesn't persist after app restart
Theme doesn't persist after app restart
This indicates localStorage isn’t saving properly:
- Check browser/WebView localStorage permissions
- Verify the app has storage access
- Look for errors in console during
setItem()call - Some browsers block localStorage in private/incognito mode
Some components stay light in dark mode
Some components stay light in dark mode
If certain UI elements don’t respect dark mode:
- Those components may not use CSS variables
- They might have hardcoded colors
- Report the issue to the development team
- Check if third-party libraries need dark mode configuration
Theme flickers on app start
Theme flickers on app start
A brief flash of light theme before dark mode applies can happen because:
- Theme is applied in
ngOnInit()(after initial render) - The HTML renders before JavaScript executes
index.html that applies theme before Angular loads:Future Enhancements
Potential dark mode improvements:- Auto-schedule: Switch to dark mode automatically at sunset
- Multiple themes: Offer additional color schemes beyond light/dark
- Granular control: Customize specific colors and accents
- Reset option: Button to clear preference and revert to system default
Related Topics
- Driver Profile - Manage your driver profile and settings
- Installation - Set up and configure the app