Open gitauto-for-dev[bot] opened 1 month ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
sample-website | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 13, 2024 11:34pm |
Resolves #80
What is the feature
Add a new icon on the top right of the website that allows users to switch between dark mode and light mode.
Why we need the feature
Introducing a dark mode enhances user experience by providing an alternative theme that can reduce eye strain, especially in low-light environments. Many users prefer dark mode for its aesthetic appeal and comfort. Offering this option can increase user satisfaction, accessibility, and engagement with the website.
How to implement and why
Design the Toggle Icon:
Position the Icon:
Define Theme Styles:
Implement Theme Switching Logic:
Persist User Preference:
localStorage
to save the user's theme preference, ensuring consistency across sessions.localStorage
for an existing preference and apply the corresponding theme automatically.Update Page Components:
pages
directory to ensure they reference the new CSS variables.Test Thoroughly:
By implementing the feature step by step, we ensure a reliable and user-friendly theme switching experience that enhances the overall usability of the website.
About backward compatibility
The addition of the theme switcher maintains backward compatibility:
Maintaining backward compatibility ensures that we cater to all users while enhancing the website's functionality.
Test these changes locally