@@ -254,21 +254,44 @@ def render(self, **kwargs):
254254 super (LayerControl , self ).render ()
255255
256256class Icon (MacroElement ):
257- def __init__ (self , color = 'blue' , icon = 'info-sign' , angle = 0 ):
258- """TODO : docstring here"""
257+ def __init__ (self , color = 'blue' , icon_color = 'white' , icon = 'info-sign' , angle = 0 , prefix = 'glyphicon' ):
258+ """Creates an Icon object, that will be rendered using Leaflet.awesome-markers.
259+
260+ Parameters
261+ ----------
262+ color : str, default 'blue'
263+ The color of the marker. You can use:
264+ ['red', 'blue', 'green', 'purple', 'orange', 'darkred', 'lightred', 'beige',
265+ 'darkblue', 'darkgreen', 'cadetblue', 'darkpurple', 'white', 'pink', 'lightblue',
266+ 'lightgreen', 'gray', 'black', 'lightgray']
267+ icon_color : str, default 'white'
268+ The color of the drawing on the marker. You can use colors above, or an html color code.
269+ icon : str, default 'info-sign'
270+ The name of the marker sign. See Font-Awesome website to choose yours.
271+ Warning : depending on the icon you choose, you may need to adapt the `prefix` as well.
272+ angle : int, default 0
273+ The icon will be rotated by this amount of degrees.
274+ prefix : str, default 'glyphicon'
275+ The prefix states the source of the icon. 'fa' for font-awesome or 'glyphicon' for bootstrap 3.
276+
277+ For more details, see https://github.com/lvoogdt/Leaflet.awesome-markers
278+ """
259279 super (Icon , self ).__init__ ()
260280 self ._name = 'Icon'
261281 self .color = color
262282 self .icon = icon
283+ self .icon_color = icon_color
263284 self .angle = angle
285+ self .prefix = prefix
264286
265287 self ._template = Template (u"""
266288 {% macro script(this, kwargs) %}
267289
268290 var {{this.get_name()}} = L.AwesomeMarkers.icon({
269291 icon: '{{this.icon}}',
292+ iconColor: '{{this.icon_color}}',
270293 markerColor: '{{this.color}}',
271- prefix: 'glyphicon ',
294+ prefix: '{{this.prefix}} ',
272295 extraClasses: 'fa-rotate-{{this.angle}}'
273296 });
274297 {{this._parent.get_name()}}.setIcon({{this.get_name()}});
0 commit comments