On this page

    Set dark mode based on system settings

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

    The dark mode become more and more popular. To determine whether the system settings are normal or dark, we employ the 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

    Was this helpful?

    SDK JS
    Examples
    Set dark mode based on system settings
    Set dark mode based on system settings