Why Theme Switching?
Allowing users to choose light or dark mode improves comfort and accessibility, especially in low-light environments.
Setup CSS Variables
Define color variables for both themes under :root and override them in a [data-theme="dark"] selector.
Implement Toggle Logic
Use a React state hook to flip between "light" and "dark", update the data-theme attribute on the element, and save the choice in local storage.
Restore on Load
On app start, read the saved theme and apply it automatically so the user’s preference persists across sessions.
Styling the Switch
Design a simple accessible switch (button or checkbox) that visually indicates the active theme and triggers the toggle.


