Basic Dark mode Demo page
(New verion 03 Feb 2025)
This is a demo page showing the basic functionality required to implement a user switchable Dark mode as described in How to setup a Dark mode switch on a web-site.
The user can overwrite the browser’s light/dark setting, and this can be reset to the browser’s setting if required. The browser setting normally follows the operating system’s mode. This page gives a message to the user regarding the option to reset to the system setting, this message only appears the first two time the switch is used. This page has a button to reset the message, this is only for testing.
Note that the colors on this page are deliberately garish rather than set for aesthetic sensibility, this is simply to show how the method works.
See How to setup a dark mode switch for your web-site for details of how to implement the method on a website.
You can download copies of these demo files here:
- Download the HTML code: dark-mode-demo-with-msg.html
- Download the basic CSS: dark-mode-demo-with-msg-6.css
- Download the JavaScript code: dark-mode-demo-with-msg-6.js
To see dark mode implemented without a hidden reset button, see the page Simple Dark mode Demo page.
The image is to demonstrate image handling on loading.