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

ascii-donut

v1.2.0

Published

A versatile JavaScript library to render mesmerizing ASCII donut animations in Node.js. Customizable foreground and background colors, interval timing, and resolution make it perfect for adding a retro terminal aesthetic to terminals (CLIs)

Readme

A versatile JavaScript library (written in typescript) to render mesmerizing ASCII donut animations in Node.js. Customizable foreground and background colors, interval timing, and resolution make it perfect for adding a retro terminal aesthetic to CLIs.

Usage Example

  1. The startAnimation() and stopAnimation() methods must be used together. They directly print animation to the console. Without stopAnimation(), startAnimation() won't work.

As these methods cause side effects, they aren't suitable for browser/gui use.

To use in browser, check out generateFrames() method.

import { Donut } from "ascii-donut";

const asciiDonut = new Donut({
  height: 22,
  width: 60,
  options: {
    foregroundColor: "green",
    // backgroundColor: "bgGreen",
    interval: 25,
  }
});

asciiDonut.startAnimation();

setTimeout(() => {
  asciiDonut.stopAnimation();
  console.log("Animation stopped.");
}, 8000);
  1. The generateFrames() is an asynchronous generator method that yields ASCII donut frames at the specified interval for the given time duration. It returns An async iterator that yields ASCII frames as strings.

This method is universal ( I guess so :) ). For example, you can achieve the above functionality with the generateFrames() method also. Look below -

const { Donut } = require("ascii-donut");

const asciiDonut = new Donut({
  height: 22,
  width: 60,
  options: {
    foregroundColor: "ylBright",
    interval: 25,
  },
});

(async () => {
  const duration = 8000; // Total animation duration in milliseconds

  const startTime = Date.now();

  // Generating and logging frames for the specified duration
  for await (const frame of asciiDonut.generateFrames(duration)) {
    console.clear();
    console.log(frame);

    console.log(`Time elapsed: ${(Date.now() - startTime) / 1000}s`);
  }

  console.log("Animation stopped.");
})();

In many interesting ways, user can implement the ascii animation by the generated frames of strings in the DOM, which is upto the user how he/she will implement that.

Library Exports

The Donut constructor is the only export from the library.

Constructor arguments

The Donut constructor is the only export from the library. It takes one argument which is an object. The object has three keys - height, width and options. The height and width are the height and width of the donut respectively. The options key takes another object which has three properties, - foregroundColor, backgroundColor and interval.

foregroundColor - color of the ascii texts in the animation (the donut). "white" by default. backgroundColor - color of the background of the donut. "bgBlack" by default. interval - frame rate of the animation. It is 50 by default.

Valid Values of Colors (foregroundColor and backgroundColor in options) for the ascii art

Foreground colors: "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "orange", "pink", "peach", "gold", "silver", "brown", "ylBright", "rdBright", "cyBright", "blBright", "mgBright", "grBright"

Background colors: "bgBlack", "bgRed", "bgGreen", "bgYellow", "bgMagenta", "bgCyan", "bgWhite", "bgOrange", "bgPeach", "bgPink", "bgBlue", "bgGold", "bgSilver", "bgBrown"