创建多组不同颜色的簇

Create multiple groups of clusters of different colors

本文关键字:颜色 创建      更新时间:2023-09-26

需要几组标记具有不同的颜色。例如,灰色标记组合在灰色圈-簇,黄色-在黄色,等等。

.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-medium {
background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
background-color: rgba(240, 194, 12, 0.6);
}
.marker-cluster-large {
background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
background-color: rgba(241, 128, 23, 0.6);
}

指定所有集群的颜色。但是如何为不同的簇做出不同的颜色呢?例如,

var groupGrey = new L.MarkerClusterGroup();
var groupRed = new L.MarkerClusterGroup();
var groupYellow = new L.MarkerClusterGroup();
var groupBlue = new L.MarkerClusterGroup();

查看iconCreateFunction选项及其默认实现