Skip to main content

Dark Mode UI

Initialize a map with dark mode map controls (buttons and menus) by adding the trimblemaps-dark class to the map. To change the map style check the Maps Styles example.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <link rel="stylesheet" href="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.css" />
        <script src="https://maps-sdk.trimblemaps.com/v3/trimblemaps-3.21.0.js"></script>
        <style>
            body { margin: 0; padding: 0; }

            #map {
                position: absolute;
                top: 0;
                bottom: 0;
                width: 100%;
            }
        </style>
    </head>
    <body>
        <div id="map" class="trimblemaps-dark"></div>

        <script>
            TrimbleMaps.APIKey = 'YOUR_API_KEY_HERE';
            const map = new TrimbleMaps.Map({
              container: 'map', // container id
                style: TrimbleMaps.Common.Style.TRANSPORTATION, // hosted style id
                center: [-77.38, 39], // starting position
                zoom: 3 // starting zoom
            });

            map.addControl(new TrimbleMaps.NavigationControl());

            const scale = new TrimbleMaps.ScaleControl({
              maxWidth: 80,
              unit: 'imperial'
            });
            map.addControl(scale);

        </script>
    </body>
</html>
Last updated December 13, 2024.