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

@askash/8bot

v1.1.1

Published

This is a package consisting of all the random 8 bit pixeleted character generation for websites web games etc

Downloads

455

Readme

8bot

A framework-agnostic library for composing 8-bit pixel objects — characters, robots, props, and geometric primitives — for webapps, web games, or anywhere else.

Install

npm install 8bot

Use a built-in object

import { createHuman, randomHuman } from "8bot/catalog";
import { drawToCanvas } from "8bot/canvas";

const human = createHuman({ palette: { outfit: "#ff5533" } });
const anyHuman = randomHuman(); // random parts + palette
const repeatableHuman = randomHuman(42); // same seed -> same human

const ctx = (document.getElementById("scene") as HTMLCanvasElement).getContext("2d")!;
drawToCanvas(ctx, human, { pixelSize: 8 });

Or render to SVG instead:

import { toSvgString } from "8bot/svg";

document.body.innerHTML = toSvgString(human, { pixelSize: 8 });

Built-in catalog

| Object | Import | Limbs | |---|---|---| | Human | createHuman, randomHuman | 2 arms, 2 legs | | Elephant | createElephant, randomElephant | 4 legs | | Tree | createTree, randomTree | none (static) | | Octopod robot | createOctopod, randomOctopod | 8 legs | | Tetrapod robot | createTetrapod, randomTetrapod | 4 legs | | Flying bot | createFlyingBot, randomFlyingBot | 2 thrusters | | Uni-eyed UFO | createUfo, randomUfo | none (static) | | Cube / Oblongoid / Sphere | createCube, createOblongoid, createSphere (+ randomX) | n/a |

Animating limbs (walk cycle)

Any object with limb slots (legs, thrusters) can be posed generically with walkCycle — no per-object animation code needed. Pass the resulting pose back into createX/compose each frame:

import { createOctopod, octopodDefinition } from "8bot/catalog";
import { walkCycle } from "8bot/core";
import { drawToCanvas } from "8bot/canvas";

function renderFrame(ctx: CanvasRenderingContext2D, t: number) {
  const pose = walkCycle(octopodDefinition, t);
  const octopod = createOctopod({ pose });
  drawToCanvas(ctx, octopod, { pixelSize: 8 });
}

In React, drive t from requestAnimationFrame:

function Robot() {
  const canvasRef = useRef<HTMLCanvasElement>(null);

  useEffect(() => {
    let frame: number;
    const start = performance.now();
    const tick = (now: number) => {
      const ctx = canvasRef.current!.getContext("2d")!;
      ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
      renderFrame(ctx, (now - start) / 200);
      frame = requestAnimationFrame(tick);
    };
    frame = requestAnimationFrame(tick);
    return () => cancelAnimationFrame(frame);
  }, []);

  return <canvas ref={canvasRef} width={64} height={56} />;
}

Positioning and interaction

8bot doesn't touch the DOM or track world position — it gives you the object's bounds at whatever position you tell it, so your app can compare against anything else on the page (e.g. a button):

import { getBounds, intersects } from "8bot/core";

const robotBounds = getBounds(octopod, { x: robotX, y: robotY }, 8);
const buttonRect = buttonEl.getBoundingClientRect();
const buttonBounds = { x: buttonRect.x, y: buttonRect.y, width: buttonRect.width, height: buttonRect.height };

if (intersects(robotBounds, buttonBounds)) {
  // the robot has "reached" the button — trigger whatever your app needs
}

Build a custom object

Custom objects use the same primitives the catalog is built from — 8bot/core is not a wrapper, it's the actual public API:

import { compose, type ObjectDefinition } from "8bot/core";

const palaceDefinition: ObjectDefinition = {
  name: "palace",
  width: 10,
  height: 10,
  slots: [
    {
      name: "wall",
      position: { x: 0, y: 0 },
      variants: [{ id: "default", anchor: { x: 0, y: 0 }, grid: [["stone"]] }],
    },
  ],
  defaultPalette: { stone: "#aaaaaa" },
  allowedRegionTags: ["stone"],
};

const palace = compose(palaceDefinition, {}, { stone: "#ffcc88" });

Isometric (2.5D) rendering

The same composed object renders flat or isometric — pass mode: "isometric" to either renderer; parts with a higher layer are drawn projected further up and to the right:

drawToCanvas(ctx, human, { mode: "isometric", pixelSize: 8 });

Contributing a new catalog object

Add a folder under src/catalog/<name>/ with parts.ts, definition.ts, and index.ts (see src/catalog/tree/ for the smallest example), then export it from src/catalog/index.ts. Mark any leg/thruster/arm slots role: "limb" to get walkCycle support for free. No core code changes needed.

Design spec

See docs/superpowers/specs/2026-07-25-8bot-design.md for the full design.