DEV Community

Muhammad Hasnain
Muhammad Hasnain

Posted on

7 3

Custom Google Maps styles, with night mode! 🌒

Dark mode has become a trend in modern day websites (pun intended, i'm so funny 🤪). Recently, I worked on a project where we had a highly customized Google Map. There were a lot of Map and DOM interactions along with styling. A lot went into it. 🥴

While studying how to style Google Maps, I stumbled across a very good resource that gives you readymade Google Maps styles, including Night Mode.

Introducing, Google Maps Styling Wizard! 🎊🎉

How To 🐱‍👓

Literally, select any style you want and click on the Finish button. It gives styles for the selected map theme in JSON format. After that, all you have to do is this.

const map = new google.maps.Map(element, {
  styles: [...], // Paste your styles here!
});
Enter fullscreen mode Exit fullscreen mode

Of course, make sure to set appropriate zoom level, position coordinates and API keys etc.

PS, the JSON formats are also a good way to learn how to style your maps. For more info, look into the official Google Map styling guide.

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (2)

Collapse
 
junaidkbr profile image
Junaid Ahmed

Thanks for sharing. Another good resource for map styles is snazzymaps.com/. Highly customizable, great community, easy to use.

Collapse
 
hasnaindev profile image
Muhammad Hasnain

Thanks for sharing this! 🙌

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay