code: function generateColoredLayers(sources, assignLayerColor) {
    var polyLayers = [];
    var circleLayers = [];
    var lineLayers = [];
  
    function alphaColors(layerId) {
      var color = assignLayerColor.bind(null, layerId);
      var obj = {
        circle: color(0.8),
        line: color(0.6),
        polygon: color(0.3),
        polygonOutline: color(0.6),
        default: color(1)
      };
      return obj;
    }
  
    Object.keys(sources).forEach(function (sourceId) {
      var layers = sources[sourceId];
  
      if (!layers || layers.length === 0) {
        var colors = alphaColors(sourceId);
        circleLayers.push(circleLayer(colors.circle, sourceId));
        lineLayers.push(lineLayer(colors.line, sourceId));
        polyLayers.push(polygonLayer(colors.polygon, colors.polygonOutline, sourceId));
      } else {
        layers.forEach(function (layerId) {
          var colors = alphaColors(layerId);
  
          circleLayers.push(circleLayer(colors.circle, sourceId, layerId));
          lineLayers.push(lineLayer(colors.line, sourceId, layerId));
          polyLayers.push(polygonLayer(colors.polygon, colors.polygonOutline, sourceId, layerId));
        });
      }
    });
  
    return polyLayers.concat(lineLayers).concat(circleLayers);
  }
docs: Generate colored layer styles for the given sources
  TODO: Improve docs
  @param {Object} Sources dict containing the vector layer IDs
  @param {Function} Function to generate a color for a layer
  @return {array} Array of Mapbox GL layers