Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 2x 13x 5x 5x 5x 5x | import type { MapOptions } from "mapbox-gl";
import { createThemedMap as createMap } from "@overworld/maps";
import type { MapTheme } from "@overworld/maps";
const theme: MapTheme = {
lightPreset: () => document.documentElement.dataset.theme === "dark" ? "night" : "day",
subscribe(listener) {
const observer = new MutationObserver(listener);
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["data-theme"]
});
return () => observer.disconnect();
}
};
export function createThemedMap(options: Omit<MapOptions, "style" | "config">) {
return createMap(options, theme);
}
|