A map can blend into a site’s design if you use the Yandex styling tool, which lets you set the colors, level of detail, and look of the map to match the project’s interface. For sites that work with customers in Russia, Yandex Maps is the usual choice: it covers Russian cities and addresses in more detail than Google Maps. Below is a step-by-step guide to adding such a map with a custom style and marker.
Style the map and get the JSON
- Open the map style editor.
- Use the settings (palette, level of detail, and so on) to create the look you need.
- When you are done, click Export JSON. On the Web tab, choose Download JSON.
- Upload the JSON file to your site, for example to the /assets/... folder.
At this stage, you shape the look of the map in the Yandex Maps API editor to match the site design. You can set a dark theme, change the color palette, lower the level of detail, hide street names, and remove extra objects such as businesses and points of interest. The result is a clean, minimal map that does not distract visitors and fits the overall interface style better.

Create an API key
- Open the developer dashboard.
- Enable the APIs: JavaScript API and HTTP Geocoder.
- Create a new key and make sure to enter your domain in the HTTP Referer restriction field. The steps are described in detail in our guide How to get a Yandex Maps API key.
- Load the API on the site page. For an English-language site, set
lang=en_US; for a Russian one,lang=ru_RU:
<script src="https://api-maps.yandex.ru/v3/?apikey=YOUR_API_KEY&lang=en_US"></script>
Add the map to the site
Create an HTML block where the map will be displayed. The container size is set with CSS.
<div id="map" style="width: 100%; height: 800px"></div>
Initialize the map with styles
At this stage, the style JSON is loaded and the map instance is created. This is also where you set the center coordinates and zoom level, and add the layers, including the custom style and the marker.
<script>
initMap();
async function initMap() {
await ymaps3.ready;
const {
YMap,
YMapDefaultSchemeLayer,
YMapMarker,
YMapDefaultFeaturesLayer
} = ymaps3;
/* Load the customization from a URL */
const customization = await fetch(
'/assets/app/js/customization-map.json' /* Path to your JSON file */
).then(r => r.json());
const map = new YMap(
document.getElementById('map'),
{
location: {
center: [37.621564, 55.753462], /* Map center as [longitude, latitude] */
zoom: 15 /* Initial zoom level (higher means closer) */
},
}
);
map.addChild(
new YMapDefaultSchemeLayer({
theme: 'dark', /* Map theme: dark (or light, or custom) */
customization: customization
})
);
map.addChild(new YMapDefaultFeaturesLayer());
const content = document.createElement('section');
const marker = new YMapMarker( /* Create the marker */
{
coordinates: [37.621564, 55.753462], /* Marker coordinates */
draggable: false /* The marker cannot be dragged */
},
content
);
map.addChild(marker);
content.innerHTML = `
<div class="map-marker">
<img src="/assets/app/img/icons/map-pointer.svg" alt=""> <!-- Path to the marker image -->
</div>
`; /* Custom marker markup */
}
</script>
Note the coordinate order: Yandex Maps API v3 takes longitude first, then latitude, the reverse of how coordinates are usually written.
Marker styles
These styles anchor the marker to its coordinate by its tip, like a pin, rather than by the top left corner of the image. The second rule makes the marker scale together with the map.
<style>
.map-marker {
position: relative;
transform: translate(-50%,-100%)
}
.map-marker img {
display: block;
transform-origin: 50% 100%;
transform: scale(var(--ymap-scale))
}
</style>
The result is not a standard map but a neat interface element that fits the site and matches the brand. An example of the final result is shown below.



