Set dark mode based on system settings

This example shows how to change the map mode (light/dark) of the map based on system settings.

The dark mode become more and more popular. To detect normal or dark system settings we use matchMedia function that allows checking programmatically whether a CSS media query (prefers-color-scheme) has been fulfilled or not.



      
      
An extension of MapLibre GL JS