On this page

    Change between light and dark mode based on the time of day

    This example demonstrates the process of altering the map display from a light to a dark mode, depending on the current time of day.

    To achieve this, the MapTiler Geolocation API is utilized to acquire the user’s location data, while the SunCalc library is employed to compute the sunrise and sunset timings based on the user’s location.

    
    
    An extension of MapLibre GL JS

    Was this helpful?

    SDK JS
    Examples
    Change between light and dark mode based on the time of day
    Change to dark mode at sunset