Dark mode for Perspective maps?

Can I change maps in Perspective to dark mode?

I don’t know what the correct way of doing it is and would also not mind finding out if there is a better way of doing it.

I found this repo that shows different leaflet map styles.
If you take the URL’s of the following two for example:

light - https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.png.png
dark - https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}{r}.png

then remove the “{r}” parameter and then dynamically link the strings to


you can then switch between dark and light mode.

Like I said, there might be a better way where you work with only 1 map url and send a parameter to change it to dark mode. Also since map tiles are buffered on the client side, switching between map sources will probably force tiles to rebuffer.

Hope this helps

edit: changed the example URL’s