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

@jolly-pixel/pixel-draw.renderer

v1.0.0

Published

Jolly Pixel Pixel Art drawer and renderer

Readme

About

@jolly-pixel/pixel-draw.renderer is a browser-based library for editing pixel-art textures. It provides zoom, pan, brush painting, right-click color picking, and an SVG cursor overlay, built around a SOLID-structured class architecture.

Features

  • Zoom & pan — smooth mouse-wheel zoom with configurable sensitivity and range; middle-click pan in any mode
  • Brush painting — configurable square brush with adjustable size, color, and opacity
  • Color picking — right-click eyedropper that reads the master canvas pixel
  • Transparency support — configurable checkerboard background renders beneath transparent pixels
  • SVG brush highlight — grid-aligned SVG overlay tracks the cursor in real time
  • Dual-canvas architecture — a master canvas (full resolution, off-screen) and a working canvas (viewport-cropped, on-screen) maintain pixel-perfect fidelity at any zoom level
  • Mode switching"paint" and "move" modes control how mouse events are interpreted

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i @jolly-pixel/pixel-draw.renderer
# or
$ yarn add @jolly-pixel/pixel-draw.renderer

Usage Examples

Minimal setup

import { CanvasManager } from "@jolly-pixel/pixel-draw.renderer";

const manager = new CanvasManager({
  texture: { size: 64 },
  zoom: {
    range: [0.5, 40],
    sensitivity: 0.002
  },
});

const container = document.getElementById("editor-container")!;
manager.reparentCanvasTo(container);
manager.resize();
manager.centerTexture();

Drawing pixels programmatically

import { CanvasManager } from "@jolly-pixel/pixel-draw.renderer";

const manager = new CanvasManager({
  texture: { size: 32 }
});
manager.reparentCanvasTo(document.body);

// Draw a red pixel at texture position (10, 10)
manager.textureBuffer.drawPixels(
  [{ x: 10, y: 10 }],
  { r: 255, g: 0, b: 0, a: 255 }
);
manager.render();

Loading an existing texture

const img = new Image();
img.src = "/assets/sprite.png";
await img.decode();

manager.setTexture(img);

Configuring the brush

manager.brush.setColor("#FF6600");
manager.brush.setOpacity(0.8);
manager.brush.setSize(3);

Switching modes

manager.setMode("move");  // left-click pans
manager.setMode("paint"); // left-click draws

Running the Examples

npm run dev -w @jolly-pixel/pixel-draw.renderer

Open http://localhost:5173 to see the interactive demo.

API

| Class | Description | |---|---| | CanvasManager | Top-level coordinator — the primary public API | | Viewport | Camera position, zoom level, and coordinate transforms | | BrushManager | Brush size, color, opacity, and affected-pixel computation | | TextureBuffer | Dual-canvas pixel storage and image-data access | | CanvasRenderer | Visible canvas drawing and checkerboard background | | InputController | Mouse event routing to drawing and pan actions | | SvgManager | SVG brush-highlight overlay |

Troubleshooting

Canvas is blank after mounting Call manager.resize() after reparentCanvasTo() to let the renderer read the parent element's dimensions, then call manager.centerTexture().

Pixels appear at the wrong position Pass { bounds: canvas.getBoundingClientRect() } when calling viewport.getMouseTexturePosition(). Stale bounding rects cause offset errors.

Master canvas is slow to initialize TextureBuffer pre-allocates a canvas at maxSize (default 2048). In test environments or when large textures are unnecessary, set texture.maxSize to a smaller value such as 64.

Contributors Guide

If you are a developer looking to contribute to the project, you must first read the CONTRIBUTING guide.

Once you have finished your development, check that the tests (and linter) are still good by running the following script:

$ npm run test
$ npm run lint

[!CAUTION] In case you introduce a new feature or fix a bug, make sure to include tests for it as well.

License

MIT