How it works
The dark mode feature works as follows:
Upon initial page load, the script checks if a dark mode setting is stored in local storage.
If a setting is stored in local storage, the dark mode is activated or deactivated accordingly.
If no setting is stored in local storage, the dark mode is set based on the user's system preferences.
An event listener is added to listen for changes in the user's system preferences and adjusts the dark mode accordingly if the user has not manually changed the setting.
The user can manually change the dark mode using the dark mode toggle. This change will be stored in local storage and will persist across page reloads.
Last updated
Was this helpful?