@@ -254,21 +254,44 @@ def render(self, **kwargs):
254
254
super (LayerControl , self ).render ()
255
255
256
256
class 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
+ """
259
279
super (Icon , self ).__init__ ()
260
280
self ._name = 'Icon'
261
281
self .color = color
262
282
self .icon = icon
283
+ self .icon_color = icon_color
263
284
self .angle = angle
285
+ self .prefix = prefix
264
286
265
287
self ._template = Template (u"""
266
288
{% macro script(this, kwargs) %}
267
289
268
290
var {{this.get_name()}} = L.AwesomeMarkers.icon({
269
291
icon: '{{this.icon}}',
292
+ iconColor: '{{this.icon_color}}',
270
293
markerColor: '{{this.color}}',
271
- prefix: 'glyphicon ',
294
+ prefix: '{{this.prefix}} ',
272
295
extraClasses: 'fa-rotate-{{this.angle}}'
273
296
});
274
297
{{this._parent.get_name()}}.setIcon({{this.get_name()}});
0 commit comments