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

rbtrees

v0.2.1

Published

An interactive step-by-step visualizer for Red-Black Tree operations. Insert, search for, or delete a number, then walk through every comparison, rotation, and recolor the algorithm performs — one frame at a time.

Downloads

193

Readme

Red-Black Tree Visualizer

An interactive step-by-step visualizer for Red-Black Tree operations. Insert, search for, or delete a number, then walk through every comparison, rotation, and recolor the algorithm performs — one frame at a time.

Live demo: https://erik.escobedo.dev/rbtree-visualizer/


Features

  • Step through each event: comparisons, rotations, recolors, found/not-found
  • Insert, find, or delete a value — all three animate the same traversal steps
  • Smooth animations for node movement, color transitions, and edge changes
  • Floating node that travels the search path, lands on insert, or fades on delete
  • Highlight ring on the active node at each step
  • CSS isolation via Shadow DOM — host-page styles cannot bleed in
  • Fully themeable via ThemeProps (colors and font family)
  • Seed the initial tree with a fixed value list or a random count
  • Responsive — works on mobile and desktop

Install

npm install rbtrees

No CSS import needed — styles are self-contained inside the Shadow DOM.


Usage

import { TreeVisualizer } from 'rbtrees'

// Empty tree, default theme
export default function App() {
  return <TreeVisualizer />
}

Pre-seeded tree

// Fixed values
<TreeVisualizer initialValues={[15, 8, 22, 4, 11]} />

// Random values
<TreeVisualizer initialRandomCount={10} />

Custom theme

import { TreeVisualizer } from 'rbtrees'
import type { ThemeProps } from 'rbtrees'

const theme: ThemeProps = {
  fontFamily: 'monospace',
  colors: {
    background: '#0d0d1a',
    text: '#00fff5',
    nodeBlack: '#1a0a2e',
    nodeRed: '#ff007f',
    nodeText: '#ffffff',
    button: { bg: '#ff007f', text: '#0d0d1a', disabled: '#2a2a4a' },
    input: { bg: '#0d0d1a', border: '#00fff5', text: '#00fff5' },
  },
}

export default function App() {
  return <TreeVisualizer theme={theme} />
}

Props

| Prop | Type | Description | |------|------|-------------| | theme | ThemeProps | Custom colors and font family | | initialValues | number[] | Pre-insert these values on mount | | initialRandomCount | number | Pre-insert this many random values (1–99) on mount |

If both initialValues and initialRandomCount are provided, initialValues wins.

ThemeProps

All fields are optional. Omitted fields fall back to the default theme.

type ThemeProps = {
  fontFamily?: string
  colors?: {
    background?: string
    text?: string
    nil?: string        // NIL sentinel node color
    nodeBlack?: string  // base color for black nodes
    nodeRed?: string    // base color for red nodes
    nodeText?: string   // label text inside nodes
    button?: { bg?: string; text?: string; disabled?: string }
    input?:  { bg?: string; border?: string; text?: string }
  }
}

Highlight variants, shadows, and glow effects are derived automatically from nodeBlack and nodeRed using color math.


Development

npm install
npm run dev       # demo app at http://localhost:5173/rbtree-visualizer/
npm run build:lib # library build → dist/

Tech stack

| Tool | Role | |------|------| | React 18 | Component model and rendering loop | | TypeScript | Strict typing throughout | | Vite | Dev server and production build | | SVG | All tree graphics — no canvas, no third-party chart library | | Shadow DOM | CSS isolation — host-page styles cannot reach inside |