npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trailstash/pinstash

v0.3.0

Published

A library for composing pinhead icons onto pins and other sprite shapes

Readme

PinStash

PinStash is a utility and library for composing Pinhead icons into various shapes, including pins, markers, circles, and squares. It's designed for map developers who need flexible, programmatically generated icons for MapLibre GL JS, Leaflet, or any other web-based mapping platform.

Features

  • Icon Composition: Layer any Pinhead icon onto background shapes.
  • Smart Coloring: Automatically chooses contrasting icon colors based on the background fill.
  • Multiple Shapes: Supports circle, square, map_pin, and marker.
  • CLI & API: Use it as a command-line tool for batch processing or as a JavaScript library in your app.
  • Custom SVGs: Pass raw SVG strings to compose custom icons

Installation

npm install @trailstash/pinstash

Options

These options are common across both the CLI and API.

| Option | Description | Default | | :------------- | :---------------------------------------------------------------- | :---------------------------------------------------- | | cornerRadius | Corner radius (applies to square only) | 4 | | fill | Sets the fill color of the icon | black or white (auto-calculated from shapeFill) | | padding | Internal padding between icon and shape edge | Varies by shape | | scale | Scale factor for the output SVG dimensions | 1 | | shape | Background shape: square, circle, map_pin, or marker | none | | shapeFill | Fill color of the background shape | black | | stroke | Color of the stroke (applies to shape if present, otherwise icon) | Auto-calculated (contrasting or darkened/lightened) | | strokeWidth | Width of the stroke | 1 for marker, else 0 |


Usage

JavaScript API

Ideal for dynamic icon generation in the browser or on the server.

import { getSprite } from "@trailstash/pinstash";

// Simple icon
const svg = getSprite("cargobike");

// Icon with background and custom colors
const marker = getSprite("jeep", {
  shape: "map_pin",
  shapeFill: "#6486f5",
  strokeWidth: 1,
});

Examples

| Result | Code | | :------------------------------------------- | :-------------------------------------------------------------------------------------------------- | | | getSprite("cargobike") | | | getSprite("cup_and_saucer", { strokeWidth: 1 }) | | | getSprite("bicycle", { shape: "circle", shapeFill: "white", fill: "#6dad6f", stroke: "#6dad6f" }) | | | getSprite("burger", { shape: "marker", shapeFill: "#3FB1CE" }) | | | getSprite("ice_cream_on_cone", { shape: "circle", shapeFill: "pink" }) | | | getSprite("rocketship", { shape: "map_pin", shapeFill: "purple" }) |

Command Line Interface (CLI)

1. Generate a single sprite

Outputs the SVG string directly to stdout.

npx pinstash get-sprite cargobike --shape=square --shapeFill='#6486f5' > icon.svg

2. Batch build from configuration

The build-sprites command creates a collection of SVG files based on a JSON configuration file. By default, it looks for pinstash.json and writes results to a ./svgs/ directory.

npx pinstash build-sprites --config my-icons.json --outdir ./assets/icons

pinstash.json structure:

{
  "groups": [
    {
      "icons": {
        "bicycle": "bike-icon",
        "bus": "bus-marker"
      },
      "options": {
        "shape": "circle",
        "shapeFill": "#6486f5"
      }
    }
  ]
}

Custom SVG icon requirements

To work with PinStash, custom SVG strings must follow these constraints:

  • Use only <path> elements.
  • Path elements should only contain the d attribute.
  • The viewBox should be "0 0 15 15", or height and width should be set to 15.

Integrations

Ultra

The develop branch(available at https://ultra.trailsta.sh) of Ultra features experimental PinStash integration . You can use it by specifying an icon-image value with the pinstash: prefix:

pinstash:ICONNAME?OPTION=VALUE

Example: pinstash:burger?shape=marker

MapLibre GL JS

To use PinStash dynamically with MapLibre:

const svg = getSprite("hospital", { shape: "circle", shapeFill: "red" });

const img = new Image();
const blob = new Blob([svgString], { type: "image/svg+xml;charset=utf-8" });
img.src = URL.createObjectURL(blob);
await img.decode();

map.addImage("hospital-icon", img);

URL.revokeObjectURL(url);

Credits & Inspiration

PinStash is inspired by the Maki Icon Editor and makiwich. It uses icons from the Pinhead project.

License

WTFPL