U
U
unclechu2015-03-13 08:16:21
JavaScript
unclechu, 2015-03-13 08:16:21

How to apply your own color palette for Yandex.Maps?

I connect maps via Yandex.Maps API 2.1, but I can't find in the documentation how to change the colors of the map palette. Is it even possible? As far as I know, Google Maps does this without problems.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ivan Goncharenko, 2016-04-11
@lutsyi

[class*="ymaps-2"][class*="-ground-pane"] {
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
    /* Firefox 3.5+ */
    -webkit-filter: grayscale(100%);
    /* Chrome 19+ & Safari 6+ */
}

R
Roman Frank, 2015-03-13
@Akellacom

Hey! At one time there was a task to make a Yandex map in BW, I found this solution jsfiddle.net/9aj8j
Try to dig in that direction, maybe it will work out.
It became interesting, I googled a little on this topic and this is what I found legal.yandex.ru/maps_api
This is a violation of the terms of use of the API
By means of the Yandex API, as I understand it, nothing can be done.
For Google Maps, I recommend gmaps-samples-v3.googlecode.com/svn/trunk/styledma...

P
Polina, 2018-09-21
@paulinekorkina

For a color map, you can use the matrix in svg. True, this still does not work in IE, in the last project the client gave up on IE and agreed to this option:
CSS:

[class*="ymaps-2"][class*="-ground-pane"] {
  -webkit-filter: grayscale(100%) url(/path-to-svg/yellowfilter.svg#yellowfilter);
          filter: grayscale(100%) url(/path-to-svg/yellowfilter.svg#yellowfilter);
}

SVG:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
  <filter id="yellowfilter">
    <feColorMatrix
    type="matrix"
    values="0.95 0 0 0 0
        0 0.77 0 0 0
        0 0 0.07 0 0
        0 0 0 1 0" />
  </filter>
</svg>

To get the matrix for the color you need, use the service andresgalante.com/RGBAtoFeColorMatrix
Result:
5ba4966c66e07420406033.png

A
Alexodiy, 2018-11-14
@Alexodiy

.ymaps-glass-pane,
 .ymaps-layers-pane {
     filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale") !important;
     -webkit-filter: grayscale(100%) !important;
 }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question