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

@ripl/terminal

v1.2.0

Published

Terminal rendering context for Ripl

Readme

@ripl/terminal

Terminal rendering context for Ripl: draw the same 2D graphics and charts to a terminal as braille-character output with ANSI truecolor.

Installation

npm install @ripl/terminal

Overview

@ripl/terminal implements Ripl's Context abstraction without any DOM. It rasterizes elements into a grid of Unicode braille dots (each character cell packs a 2×4 sub-pixel grid) and writes them to a runtime-agnostic TerminalOutput adapter: process.stdout in Node, or an xterm.js instance in the browser. Because every Ripl element renders through the shared Context API, scenes written for Canvas or SVG render unchanged in the terminal.

Optional logicalWidth/logicalHeight options let you author a scene in CSS-pixel coordinates; the context uniformly scales and letterboxes that space into the character grid so it renders proportionally in any terminal size.

Limitations

The terminal context is a rasterizer onto a character grid, so parts of the canvas contract cannot be honored. Everything below is deliberate; none of it errors.

| Feature | Behavior | |---|---| | Transforms (translate/rotate/scale, and element/group transform state) | Discarded. Not approximated — an element renders at its untransformed coordinates. A rotated axis title draws horizontally across the plot; a marker rotated by π/4 draws unrotated. Warns once per context. | | Hit testing | Not supported. isPointInPath/isPointInStroke always return false, so pointer events never match elements. | | Clipping and images | applyClip and drawImage are no-ops. | | Text metrics | One terminal cell per glyph, regardless of font. The font state has no visual effect. | | Text on a path | Drawn straight from the anchor; pathData/startOffset are ignored. | | Fill rule | Even-odd only; a nonzero fill rule is ignored. | | Gradients and patterns | Resolved to a single color — the gradient's first stop, or the pattern's foreground. | | Opacity and alpha | A cell is lit or unlit, so opacity and a paint's own alpha darken the color toward an assumed dark background. Zero alpha draws nothing. | | Stroke geometry | lineWidth is honored, by stamping a round brush along the path. The brush centres on a dot, so thickness quantises to an odd number of dots — widths of 1, 2, 3, 4 and 5 give strokes 1, 3, 3, 5 and 5 dots across. lineCap, lineJoin and miterLimit are ignored: the brush makes every cap and join round. lineDash/lineDashOffset are honored, with arc length measured along the centreline and approximated by plotted-pixel count. | | Shadows, filters, compositing | Ignored. globalCompositeOperation: 'destination-out' warns: canvas erases where the terminal draws, so that geometry renders inverted rather than merely degraded. |

Charts that rely on transforms (rotated axis titles, rotated symbols) render legibly but not identically to canvas.

Usage

import {
    createContext,
} from '@ripl/terminal';

import {
    createCircle,
} from '@ripl/core';

// `output` implements { write, columns, rows, onResize? }
const context = createContext(output, {
    logicalWidth: 800,
    logicalHeight: 600,
});

createCircle({
    stroke: '#38bdf8',
    cx: 400,
    cy: 300,
    radius: 150,
}).render(context);

In Node, use @ripl/node to obtain a stdout-backed output adapter.

Exporting

const snapshot = context.export();

const text = snapshot.toString(); // plain braille art
const image = await snapshot.toImage(); // ImageData (rasterized)
const url = snapshot.toURL(); // PNG object URL (browser)

snapshot.release(); // revokes the object URL

A glyph occupies a whole cell, which is only 2×4 pixels in the exported image — too small for a letterform — so text rasterizes as a filled block rather than being dropped from the image.

Documentation

Full documentation and interactive demos are available at ripl.run.

License

MIT