You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

leaflet-texticon

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-texticon

Text icon for Leaflet Markers

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
9
200%
Maintainers
1
Weekly downloads
 
Created
Source

Leaflet.TextIcon

Custom icon for Leaflet with dynamic text

Adapted from: https://gist.github.com/comp615/2288108

Usage

Install with bower: bower install Leaflet.TextIcon

Link script and css into html (or use wiredep):

<link rel="stylesheet" href="bower_components/Leaflet.TextIcon/leaflet-text-icon.css" />
<script src="bower_components/Leaflet.TextIcon/leaflet-text-icon.js"></script>

Create marker with L.TextIcon:

var icon = new L.TextIcon({ text: '12', color: 'red' });
var marker = L.marker([lat, lng], { icon: icon }).addTo(map);

Options

  • color base color of icon; available values: blue (default), green, red
  • text text to display inside marker icon; alhough not restricted, should not be longer than 2 characters
  • other leaflet icon options; icon and shadow URLs are ignored

Methods

  • setColor(color) change icon base color; one of blue, green, red
  • setText(text) change icon text
marker.options.icon.setColor('green');
marker.options.icon.setText('21');

Demo

FAQs

Package last updated on 19 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.