maputnik/src/style.js

15 lines
306 B
JavaScript
Raw Normal View History

2016-09-08 21:42:18 +02:00
import React from 'react';
2016-09-09 18:53:57 +02:00
import randomColor from 'randomcolor'
2016-09-09 23:25:06 +02:00
export function colorizeLayers(layers) {
2016-09-09 18:53:57 +02:00
return layers.map(layer => {
if(!layer.metadata) {
layer.metadata = {}
}
if(!"mapolo:color" in layer.metadata) {
layer.metadata["mapolo:color"] = randomColor()
}
return layer
})
}