GitAuto: Add a new icon on the top right to switch this entire website between dark mode and light mode #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 a visual option that's easier on the eyes in low-light environments. It caters to user preferences, improves accessibility, and aligns the website with modern UI/UX trends where dark mode has become a standard feature.
How to implement and why
Design the Theme Toggle Icon:
Update the Layout:
Implement Theme Switching Logic:
data-themeattribute on the<body>tag.localStorageto persist it across sessions.Refactor Stylesheets:
data-themeattribute.Accessibility Considerations:
aria-labelsfor the toggle icon for screen readers.Testing:
Implementing the feature step by step ensures a smooth integration while maintaining the existing codebase's integrity.
About backward compatibility
This addition is backward compatible. It doesn't alter existing functionalities but enhances the user interface by providing an optional feature. Users who prefer the default light mode or choose not to interact with the theme toggle will experience the website as before. Existing styles and scripts remain unaffected unless interacting with the new theme variables.
Test these changes locally