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

@geogdev/styles

v0.1.2

Published

Geog map styles for MapLibre GL

Readme

@geogdev/styles

MapLibre GL layer styles for OpenMapTiles-compatible vector tiles.

Installation

npm / pnpm / yarn

npm install @geogdev/styles

CDN (Browser)

<script src="https://unpkg.com/@geogdev/styles/dist/styles.js"></script>

Quick Start

ESM / TypeScript

import maplibregl from "maplibre-gl";
import { layers, LIGHT, DARK, GRAY, WARM } from "@geogdev/styles";

const map = new maplibregl.Map({
  container: "map",
  center: [-93.265, 44.977],
  zoom: 12,
  style: {
    version: 8,
    glyphs: "https://your-server.com/fonts/{fontstack}/{range}.pbf",
    sprite: "https://your-server.com/sprites/light",
    sources: {
      basemap: {
        type: "vector",
        url: "https://your-server.com/tiles.json"
      }
    },
    layers: layers("basemap", LIGHT, { lang: "en" })
  }
});

Browser (CDN)

<script src="https://unpkg.com/[email protected]/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/@geogdev/styles/dist/styles.js"></script>
<script>
  const mapLayers = styles.layers("basemap", styles.LIGHT, { lang: "en" });

  const map = new maplibregl.Map({
    container: "map",
    style: {
      version: 8,
      glyphs: "https://your-server.com/fonts/{fontstack}/{range}.pbf",
      sprite: "https://your-server.com/sprites/light",
      sources: {
        basemap: { type: "vector", url: "https://your-server.com/tiles.json" }
      },
      layers: mapLayers
    }
  });
</script>

Available Themes

| Theme | Description | |-------|-------------| | LIGHT | Natural colors, high contrast labels | | DARK | Subdued colors for dark mode | | GRAY | Monochrome, ideal for data viz overlays | | WARM | Earthy, sepia-toned palette |

API Reference

layers(source, style, options?)

Generates MapLibre GL layer specifications.

import { layers, LIGHT } from "@geogdev/styles";

// Generate all layers (base + labels)
layers("basemap", LIGHT, { lang: "en" });

// Generate base layers only (no labels)
layers("basemap", LIGHT);

// Generate labels only
layers("basemap", LIGHT, { labelsOnly: true, lang: "en" });

Parameters:

| Parameter | Type | Description | |-----------|------|-------------| | source | string | Source ID matching your MapLibre sources config | | style | Style | Theme preset (LIGHT, DARK, GRAY, WARM) | | options.lang | string | Language code for labels (e.g., "en", "de", "ja") | | options.labelsOnly | boolean | If true, only generate label layers |

namedStyle(name)

Get a style preset by string name.

import { namedStyle } from "@geogdev/styles";

const style = namedStyle("dark"); // Returns DARK

Style Presets

import { LIGHT, DARK, GRAY, WARM } from "@geogdev/styles";
import { STYLE_NAMES, isValidStyleName } from "@geogdev/styles";

// STYLE_NAMES = ["light", "dark", "gray", "warm"]
isValidStyleName("dark"); // true

TypeScript Types

import type { Style, StyleName } from "@geogdev/styles";

// StyleName = "light" | "dark" | "gray" | "warm"
// Style = interface with all color properties

Theme Switching

import { layers, LIGHT, DARK } from "@geogdev/styles";

function switchTheme(map, theme) {
  const newStyle = {
    version: 8,
    glyphs: "https://your-server.com/fonts/{fontstack}/{range}.pbf",
    sprite: `https://your-server.com/sprites/${theme === DARK ? "dark" : "light"}`,
    sources: {
      basemap: { type: "vector", url: "https://your-server.com/tiles.json" }
    },
    layers: layers("basemap", theme, { lang: "en" })
  };
  map.setStyle(newStyle);
}

// Usage
switchTheme(map, DARK);

Requirements

This package generates layer specifications only. You must provide:

  1. Tile source - OpenMapTiles-compatible vector tiles (PMTiles, TileJSON, etc.)
  2. Fonts (glyphs) - PBF font files for text rendering
  3. Sprites - Icon sprite sheets (PNG + JSON)

Development

# Build the package
npm run build

# Run tests
npm test

# Type checking
npm run tsc

# Format code
npm run format

# Generate style JSON (via npm script)
npm run generate_style output.json https://example.com/tiles.json light en

# Or via the installed CLI
npx geog-generate-style output.json https://example.com/tiles.json light en

License

BSD-3-Clause