diff --git a/.changeset/map-palette.md b/.changeset/map-palette.md
new file mode 100644
index 000000000..1da5d72c6
--- /dev/null
+++ b/.changeset/map-palette.md
@@ -0,0 +1,6 @@
+---
+"@tabler/preview": minor
+"@tabler/docs": patch
+---
+
+Updated the map demos with softer map colors: a `tablerMapPalette()` script recolors the `positron` and `dark` styles.
diff --git a/docs/content/ui/components/map.mdx b/docs/content/ui/components/map.mdx
index e9ee709cd..a550bc8f4 100644
--- a/docs/content/ui/components/map.mdx
+++ b/docs/content/ui/components/map.mdx
@@ -33,10 +33,13 @@ classnames:
---
import Example from '@components/Example.astro';
import Map from '@shared/components/demo/Map.astro';
+import MapPalette from '@shared/components/demo/MapPalette.astro';
import Icon from '@ui/Icon.astro';
import { Code } from 'astro:components';
import { site } from '@shared/lib/site.ts';
+
+
## Overview
The map is a small wrapper around [MapLibre GL JS](https://maplibre.org/maplibre-gl-js/docs/), an open-source map library. Tabler gives you the container markup and a short init script. MapLibre draws the tiles, handles zoom, and renders the markers.
@@ -107,7 +110,7 @@ Set `style` to the URL of any MapLibre style. OpenFreeMap has five of them:
| Style | Result |
| --- | --- |
-| `https://tiles.openfreemap.org/styles/positron` | Light gray map, used by the Tabler demos. Markers and data stand out on it. |
+| `https://tiles.openfreemap.org/styles/positron` | Light gray map, used by the Tabler demos with [softer colors](#map-colors). Markers and data stand out on it. |
| `https://tiles.openfreemap.org/styles/dark` | Dark gray map, used by the demos in dark mode. |
| `https://tiles.openfreemap.org/styles/liberty` | Street map in color. |
| `https://tiles.openfreemap.org/styles/bright` | Street map with stronger colors. |
@@ -117,6 +120,20 @@ Set `style` to the URL of any MapLibre style. OpenFreeMap has five of them:
+### Map colors
+
+The Tabler demos make the `positron` and `dark` styles softer: near-white land, pale water and muted labels in light mode, and blue-gray water and roads in dark mode. They do it by changing the paint values of the style layers after the style loads:
+
+```js
+map.on('style.load', function () {
+ map.setPaintProperty('background', 'background-color', '#fafaf8')
+ map.setPaintProperty('water', 'fill-color', '#d4dadc')
+ map.setPaintProperty('boundary_2', 'line-color', '#e3cdd0')
+})
+```
+
+The full list of colors for both modes is in the `tablerMapPalette()` function in the source of the [maps preview page](https://preview.tabler.io/maps.html). Copy it to get the same look. The layer names belong to the OpenFreeMap styles, so the function works only with them.
+
Styles from other providers work the same way, as long as they follow the MapLibre style format. Check the terms of each provider, as many of them need an API key or a paid plan.
### Markers
diff --git a/preview/pages/map-fullsize.astro b/preview/pages/map-fullsize.astro
index a9ab656ce..d5fa83d07 100644
--- a/preview/pages/map-fullsize.astro
+++ b/preview/pages/map-fullsize.astro
@@ -1,10 +1,12 @@
---
import DefaultLayout from '@shared/layouts/DefaultLayout.astro'
import CaptureScript from '@shared/components/CaptureScript.astro'
+import MapPalette from '@components/demo/MapPalette.astro'
---
Full Size Map
+
@@ -12,7 +14,8 @@ import CaptureScript from '@shared/components/CaptureScript.astro'
window.tabler_map ??= {}
function initMap() {
- const themeStyle = () => `https://tiles.openfreemap.org/styles/${document.documentElement.getAttribute('data-bs-theme') === 'dark' ? 'dark' : 'positron'}`
+ const theme = () => (document.documentElement.getAttribute('data-bs-theme') === 'dark' ? 'dark' : 'light')
+ const themeStyle = () => `https://tiles.openfreemap.org/styles/${theme() === 'dark' ? 'dark' : 'positron'}`
const map = new maplibregl.Map({
container: 'map-fullsize',
@@ -23,6 +26,9 @@ import CaptureScript from '@shared/components/CaptureScript.astro'
map.addControl(new maplibregl.NavigationControl())
+ // Softer map colors, set again each time the style loads
+ map.on('style.load', () => tablerMapPalette(map, theme()))
+
// Change the map style when the page theme changes
new MutationObserver(() => map.setStyle(themeStyle())).observe(document.documentElement, { attributeFilter: ['data-bs-theme'] })
diff --git a/preview/pages/maps.astro b/preview/pages/maps.astro
index 64f0f1780..0f5279d31 100644
--- a/preview/pages/maps.astro
+++ b/preview/pages/maps.astro
@@ -1,6 +1,7 @@
---
import DefaultLayout from '@shared/layouts/DefaultLayout.astro'
import Map from '@components/demo/Map.astro'
+import MapPalette from '@components/demo/MapPalette.astro'
import Card from '@ui/Card.astro'
import CardBody from '@ui/CardBody.astro'
import maps from '@data/maps.json'
@@ -78,6 +79,7 @@ const places = [
+
+
+