Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add automatic time-based dark mode switching #208

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Sharma-IT
Copy link

Automatic Dark Mode with Time-based Switching

Overview

This PR introduces automatic dark mode switching based on user-defined time schedules. Users can now choose between manual theme control or automatic switching that changes between light and dark themes at specified hours.

Key Features

  • Automatic Theme Switching: Theme automatically switches between light/dark based on time
  • Configurable Schedule: Users can set custom start/end hours for dark mode
  • Midnight Handling: Properly handles schedules that span across midnight
  • Immediate Application: Theme updates instantly when changing modes or times

Implementation Details

Theme Mode Selection

  • Added theme mode selector (auto/manual) using React Select
  • Implemented immediate theme checking when switching to auto mode
  • Added time input fields for configuring auto mode schedule
  • Styled inputs to match existing design system

Theme Logic

  • Added logic to handle time-based theme switching
  • Implemented cross-midnight schedule support
  • Added immediate theme application on mode/time changes
  • Updated theme preferences structure to support auto mode

Analytics

  • Added separate tracking for theme mode (auto/manual)
  • Added THEME_MODE attribute to analytics events
  • Maintained existing theme color change tracking
  • Added user identification for theme preferences

UI/UX Improvements

  • Consistent styling with existing settings
  • Clear visual hierarchy in theme settings
  • Proper spacing and alignment in settings panel
  • Responsive design support

- Add automatic theme mode option with configurable hours:
  - Implement time-based theme switching (dark/light)
  - Add user-configurable start and end hours
  - Handle theme transitions across midnight

- Add new theme preferences:
  - ThemeMode type ('auto' | 'manual')
  - autoStartHour and autoEndHour settings
  - Immediate theme application on mode change

- Update UI components:
  - Add theme mode selector with auto/manual options
  - Add time input fields for auto mode schedule
  - Style time inputs to match design system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant