---
title: "Map Styling · Nuxt Scripts"
description: "Style interactive and static maps with JSON rules, cloud map IDs, and color mode."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/guides/map-styling"
meta:
  "og:description": "Style interactive and static maps with JSON rules, cloud map IDs, and color mode."
  "og:image": "https://scripts.nuxt.com/_og/s/o_683e4532c8b4a5b3.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Map Styling · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_683e4532c8b4a5b3.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Guides**

# **Map Styling**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/map-styling.md)

Google Maps supports two styling approaches: legacy JSON styles and cloud-based map IDs. Both work with Nuxt Scripts. A static map uses its own `**style**` or `**mapId**` prop.

## JSON Styles

Use the `**mapOptions.styles**` prop with a JSON style array. Google's [**JSON style reference**](https://developers.google.com/maps/documentation/javascript/style-reference) covers the supported features, elements, and stylers.

These styles apply to the interactive map. To match a [`**ScriptGoogleMapsStaticMap**`](https://scripts.nuxt.com/scripts/google-maps/api/static-map) placeholder, pass the same array to its `**style**` prop as well.

JSON `**styles**` cannot combine with `**ScriptGoogleMapsMarker**`. When `**styles**` is set without an explicit `**mapId**`, Nuxt Scripts suppresses its fallback map ID, while Google's [`**AdvancedMarkerElement**`** requires a map ID**](https://developers.google.com/maps/documentation/javascript/advanced-markers/start). If the map contains markers, use [**cloud-based map IDs**](#cloud-based-map-ids) instead.

```vue
<script setup lang="ts">
const mapOptions = {
  styles: [
    {
      elementType: 'labels',
      stylers: [{ visibility: 'off' }, { color: '#f49f53' }],
    },
    {
      featureType: 'landscape',
      stylers: [{ color: '#f9ddc5' }, { lightness: -7 }],
    },
    {
      featureType: 'road',
      stylers: [{ color: '#813033' }, { lightness: 43 }],
    },
    {
      featureType: 'water',
      stylers: [
        { color: '#1994bf' },
        { saturation: -69 },
        { gamma: 0.99 },
        { lightness: 43 },
      ],
    },
    {
      featureType: 'poi.park',
      stylers: [{ color: '#645c20' }, { lightness: 39 }],
    },
  ],
}
</script>

<template>
  <ScriptGoogleMaps :map-options="mapOptions" />
</template>
```

## Cloud-Based Map IDs

Google's [**Map Styling**](https://developers.google.com/maps/documentation/cloud-customization) lets you create and manage styles in the Google Cloud Console, then apply them with a map ID.

```vue
<template>
  <ScriptGoogleMaps
    :map-options="{
      mapId: 'YOUR_MAP_ID',
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 12,
    }"
  />
</template>
```

JSON `**styles**` and `**mapId**` are mutually exclusive. When both are supplied explicitly, the current component forwards both values; Google controls the style through the map ID instead of applying the JSON styles. Because `**ScriptGoogleMapsMarker**` uses `**AdvancedMarkerElement**`, cloud-based map IDs are the way to style a map that contains markers.

When you omit `**mapId**`, Nuxt Scripts supplies Google's `**DEMO_MAP_ID**` so advanced markers can render. Google documents that ID for testing only; create and pass your own map ID in production.

## Dark Mode / Color Mode

Switch map styles automatically based on the user's color mode preference. Provide a `**mapIds**` object with light and dark map IDs:

```vue
<template>
  <ScriptGoogleMaps
    :map-ids="{ light: 'LIGHT_MAP_ID', dark: 'DARK_MAP_ID' }"
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 12,
    }"
  />
</template>
```

If you set up a single Map ID in Google Cloud Console with both Light and Dark color schemes, point both keys at the same id and the map will pick up Google's `**colorScheme**` automatically:

```vue
<template>
  <ScriptGoogleMaps
    :map-ids="{ light: 'YOUR_MAP_ID', dark: 'YOUR_MAP_ID' }"
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 12,
    }"
  />
</template>
```

Google Maps treats both `**mapId**` and `**colorScheme**` as init-only options. Toggling color mode tears down and re-creates the basic `**Map**` instance; Google does not support changing these without re-rendering. The component preserves the user's pan/zoom and remounts child components (markers, info windows, overlays) against the new map automatically.

If you create resources imperatively from the exposed `**map**` ref (rather than via child components), listen for the `**@ready**` event; it re-fires after every re-init so you can re-attach them to the new map instance.

This auto-detects `**@nuxtjs/color-mode**` if installed. You can also control it manually with the `**colorMode**` prop:

```vue
<script setup lang="ts">
const isDark = ref(false)
</script>

<template>
  <ScriptGoogleMaps
    :map-ids="{ light: 'LIGHT_MAP_ID', dark: 'DARK_MAP_ID' }"
    :color-mode="isDark ? 'dark' : 'light'"
  />
  <button @click="isDark = !isDark">
    Toggle Dark Mode
  </button>
</template>
```

See [**Markers & Info Windows**](https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows) for combining styled maps with custom marker content.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/1.guides/2.map-styling.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/map-styling.md)

[**Performance** Defer the Maps JavaScript API, reserve map space, and reduce unnecessary dynamic map loads.](https://scripts.nuxt.com/scripts/google-maps/guides/performance) [**Example: Markers & Info Windows** Add advanced markers, info windows, and custom HTML popups to a Google map.](https://scripts.nuxt.com/scripts/google-maps/guides/markers-and-info-windows)

**On this page **

- [JSON Styles](#json-styles)
- [Cloud-Based Map IDs](#cloud-based-map-ids)
- [Dark Mode / Color Mode](#dark-mode-color-mode)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/map-styling#webpage","@type":"WebPage","description":"Style interactive and static maps with JSON rules, cloud map IDs, and color mode.","name":"Map Styling","url":"https://scripts.nuxt.com/scripts/google-maps/guides/map-styling","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/map-styling#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/guides/map-styling"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/map-styling#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Google Maps","item":"https://scripts.nuxt.com/scripts/google-maps","position":3},{"@type":"ListItem","name":"Guides","item":"https://scripts.nuxt.com/scripts/google-maps/guides","position":4},{"@type":"ListItem","name":"Map Styling","item":"https://scripts.nuxt.com/scripts/google-maps/guides/map-styling","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
