Basic Dark mode Demo page

(New verion 09 Sep 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:

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.

 Color Wheel

 

Click the ⠇ to enable resetting the light/dark setting to your system setting.
This element has a border only when in dark mode, declared in a <style> tag in the HTML head as:
  @media (prefers-color-scheme: dark) {
    .myBorder {
      border:5px solid red;
    }
  }
This element has a box-shadow only when in light mode, declared in the CSS file as:
  @media (prefers-color-scheme: light) {
    .myShadow {
      box-shadow: 13px 10px …;
    }
  }