I previously used darkmode.addEventListener('change', ({ matches }) => map.setOptions({ styles: matches ? darkmodeStyles : null }));
which worked great! But since Google Maps is deprecating google.maps.Marker
I need to switch to google.maps.marker.AdvancedMarkerElement
, which requires a mapID and styling doesn't work anymore when mapID is used.
Is there a way to instantly switch to dark mode when using mapIDs?
Because the only solution I see currently is to create a whole new map instance in order to provide a new mapID, but that is not an acceptable solution to switch to dark mode because you lose the current map.