问题
Google has just changed the maps colors scheme and it has messed up the custom colors on a site I'm working on. This is the news from their blog:
Discover the action around you with the updated Google Maps
Now, not much technical info there. Has anyone already found out where to change that light brown/orange-ish color for "areas of interest"?
From testing here (and this link is on their dev site), the only thing that does anything to it is all, and the more specific you can go is with Feature type: all Element type: geometry.fill
回答1:
To really 'hide' the areas of interest: first set a color on all geometries, and than override that setting by specifying the colors for water, parks, roads et cetera.
Code sample:
var myStyle = [
{featureType: "all", elementType: "geometry.fill", stylers: [{color: "#CCCCCC"}]},
{featureType: "water", elementType: "geometry", stylers: [{hue: "#99CCFF"}, {lightness: 30}, {saturation: 50}]},
{featureType: "road", elementType: "geometry", stylers: [{color: "#eeeeee"},{lightness: 30},{visibility: "simplified"}]},
{featureType: "landscape.natural", elementType: "geometry", stylers: [{color: "#c4d7cd"}]},
{featureType: "poi.park", elementType: "geometry", stylers: [{color: "#b4d9c6"}]},
];
回答2:
I made a leap of faith and set modifiers for "featureType":"areaOfInterest" and surprisingly it worked!! You can use areaOfInterest as the feature type to target styles for it as you would any other feature type.
I set this style and got the following result:
{
"featureType":"areaOfInterest",
"stylers":[
{"saturation" : -100},
{"lightness" : 25},
{"visibility" : "simplified"}
]
}
Keep in mind that this style is for the gmaps4rails gem plugin and the syntax may differ for your application.
Before:
After:
回答3:
I took RSmithlal code and slightly amended it to target only the overlay color that covers areas of interest. This way I could keep the label colours unchanged:
{
featureType:'areaOfInterest',
elementType: 'geometry',
stylers:[
{saturation : -100}
]
}
来源:https://stackoverflow.com/questions/38599809/color-areas-of-interest-on-google-maps-api