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 🙏

© 2025 – Pkg Stats / Ryan Hefner

textmode.export.js

v1.2.0

Published

Export plugin for textmode.js - Save your creations as images, GIFs, videos, SVG, and plain text.

Readme

textmode.export.js (✿◕‿◕)ノ

| TypeScript Vite | API docs Discord | ko-fi Github-sponsors | |:-------------|:-------------|:-------------|

textmode.export.js is an add-on library for textmode.js that adds various export options to your Textmodifier instance, including:

  • Plain text (.txt)
  • Image files (.png, .jpg, .webp)
  • Animated image files (.gif)
  • Video files (.webm)
  • Scalable vector graphics (.svg)

Besides exporting programatically, textmode.export.js also provides an overlay UI for users to easily export their creations.

Installation

Prerequisites

  • textmode.export.js requires textmode.js v0.4.0 or later.

UMD

To use textmode.export.js in a UMD environment, download the latest umd build from the GitHub releases page or import it directly from a CDN like jsDelivr. The library is distributed as a single JavaScript file, which you can include in your project by adding the following script tag to your HTML file:

<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
    <title>textmode.js sketch</title>

    <!-- Import textmode.js from jsDelivr CDN -->
    <script src="https://cdn.jsdelivr.net/npm/textmode.js@latest/dist/textmode.umd.js"></script>

    <!-- Import textmode.export.js from jsDelivr CDN -->
    <script src="https://cdn.jsdelivr.net/npm/textmode.export.js@latest/dist/textmode.export.umd.js"></script>
</head>
<body>
    <script src="sketch.js"></script>
</body>
</html>
// sketch.js
const t = textmode.create({
    width: window.innerWidth,
    height: window.innerHeight,
    fontSize: 16,
    frameRate: 60,
    plugins: [
        createTextmodeExportPlugin({
            overlay: false
        })
    ]
});

t.setup(() => {
    // Optional setup code here (e.g., load fonts/shaders, initialize variables that access 't')
});

t.draw(() => {
    t.background(32); // Dark gray background

    t.char('A');
    t.charColor(255, 0, 0); // Cover the top-left quarter of the grid with a rectangle of red 'A's
    t.rect(0, 0, t.grid.cols / 2, t.grid.rows / 2);

    // ...add your drawing code here!

    if (t.frameCount === 60) {
        t.saveCanvas({
            format: 'png',
            filename: 'my-sketch'
        });
    }
});

t.windowResized(() => {
    t.resizeCanvas(window.innerWidth, window.innerHeight);
});

ESM

To use textmode.export.js in an ESM environment, you can install it via npm:

npm install textmode.export.js

Then, you can import it in your JavaScript or TypeScript files:

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>textmode.js sketch</title>
</head>
<body>
    <script type="module" src="./sketch.js"></script>
</body>
</html>
// sketch.js
import { textmode } from 'textmode.js';
import { createTextmodeExportPlugin } from 'textmode.export.js';

const t = textmode.create({
    width: window.innerWidth,
    height: window.innerHeight,
    fontSize: 16,
    frameRate: 60,
    plugins: [
        createTextmodeExportPlugin({
            overlay: false
        })
    ]
});

t.setup(() => {
    // Optional setup code here (e.g., load fonts/shaders, initialize variables that access 't')
});

t.draw(() => {
    t.background(32); // Dark gray background

    t.char('A');
    t.charColor(255, 0, 0); // Cover the top-left quarter of the grid with a rectangle of red 'A's
    t.rect(0, 0, t.grid.cols / 2, t.grid.rows / 2);

    // ...add your drawing code here!

    if (t.frameCount === 60) {
        t.saveCanvas({
            format: 'png',
            filename: 'my-sketch'
        });
    }
});

t.windowResized(() => {
    t.resizeCanvas(window.innerWidth, window.innerHeight);
});

Next steps

Now that you have textmode.export.js set up, you can explore the following resources to learn more about its features and capabilities:

📚 Visit the Official Documentation for a detailed guide on how to use the textmode.export.js and all its features.

🔍 Browse the TypeDoc API reference hosted right here in the repository for in-depth API details.

Acknowledgements

textmode.export.js packages webm-writer-js by Nicholas Sherlock to provide WebM video export support. webm-writer-js is distributed under the WTFPL v2 license.

Animated GIF export relies on gifenc by Matt DesLauriers, available under the MIT License.