Basic Dark mode Demo page with Message
(Updated 10 Oct 2026)
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.
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.css
- Download the JavaScript code: dark-mode-demo-with-msg.js
To see dark mode implemented without a message to the user, see the page Simple Dark mode Demo page.
These images demonstrate an inversion filter applied only when in dark mode.
