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

chromata

v0.4.4

Published

A modern, extensible, fast syntax highlighter for code. Lightweight, pluggable, and themeable.

Readme

Chromata

NPM version Coverage Status Publish to NPM

Chromata is a modern, extensible, and fast syntax highlighter for code.
Lightweight, pluggable, and themeable.
Supports TypeScript, Angular, JavaScript, and more.

Table of Contents

  • Key Principles
  • Installation
  • Usage
  • API Overview
  • Themes
  • Supported Languages
  • Extending Chromata
  • Philosophy
  • License

Key Principles

  • Ultra-fast and lightweight core
  • Fully themeable (VS Code Dark+, Light+, and custom themes)
  • Extensible via hooks and plugins (custom languages, tokens, etc.)
  • Usable in Node.js, browser, and frameworks (Angular, React, Vue, etc.)
  • Formats code as HTML or DOM nodes
  • Type-safe API (written in TypeScript)
  • MIT licensed, open-source

Installation

npm install chromata

Usage

Chromata currently highlights a plain code string and outputs HTML.
The HTML contains <span> elements with token type classes (e.g., keyword, string, comment)
which are styled via a theme.

import { Chromata } from "chromata";

// Initialize with default settings (TypeScript + vscode-dark)
Chromata.init({
  language: "typescript",
  theme: "vscode-dark",
  injectCss: true, // Automatically injects theme CSS into the browser <head>
});

// Highlight a TypeScript code string
const code = `export class AuthService {}`;
const html = Chromata.highlight(code);

console.log(html);
// Example output:
// <span class="keyword">export</span> class AuthService {}

In a browser, if injectCss is enabled, Chromata will automatically inject the CSS for the selected theme.
If running server-side, you can retrieve the CSS with:

import { getTheme } from "chromata";

const css = getTheme("vscode-dark").toString();

…and inject it manually in your page.

API Overview

Chromata provides functions to format code with syntax highlighting either as HTML strings or as DOM nodes.
It is extensible through hooks and plugins, and supports multiple themes and languages.

Full API documentation and usage examples will be added soon.

Themes

Chromata includes several built-in themes (including VS Code Dark+ and Light+) and allows for custom theme registration.

Supported Languages

  • TypeScript
  • Angular (templates & decorators)
  • JavaScript

Support for more languages is planned.

Extending Chromata

Chromata is built to be extensible:

  • Register custom languages, tokens, or themes
  • Add hooks to customize tokenization and rendering

Philosophy

Chromata aims to provide a minimal yet powerful foundation for syntax highlighting:

  • No forced choices: you decide how code is rendered and styled
  • Small and efficient: optimized for speed and simplicity
  • Structured first: themes and grammars work with structured tokens
  • Extensible by design: designed to grow with your project’s needs

License

MIT License

© Sébastien Bosmans