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

contrib-aquarium

v0.1.14

Published

A living SVG aquarium driven by a GitHub contribution graph — embeddable in profile READMEs.

Readme

contrib-aquarium

Self-contained SVG (CSS + SMIL) — no JavaScript in the embed, so GitHub can host it as a normal image. Dark water, brass rim; readable on light and dark themes.

自包含 SVG(CSS + SMIL),嵌入不需要 JS,可当普通图片用。暗水色 + 铜框,浅色 / 深色主题都站得住。

npx contrib-aquarium · package contrib-aquarium · v0.1.13 · Node.js 18.18+


Features · 特性

| | EN | 中文 | | --- | --- | --- | | Mapping | Year total → fish count; streaks → kelp; last 14 days → bubbles | 全年总数 → 鱼数;连续打卡 → 海藻;近两周 → 气泡 | | Sources | GraphQL calendar, public events, or deterministic mock | GraphQL 日历 / 公开 Events / 确定性 mock | | Themes | deep · reef · midnight · lagoon · ember · fog · aurora (palette only) | 七种配色,布局与映射不变 | | Embed | Commit SVG, or refresh daily via composite Action | 提交 SVG,或用 Action 每日重画 | | API | CLI + TypeScript library | CLI + 库 | | Actions | --github workflow commands (::notice:: / ::error::) + job summary | --github 输出 Actions 注解与 Job Summary | | HTML | --html [path] self-contained offline report (no CDN) | --html [path] 自包含离线报告(无 CDN) | | Clipboard | --copy copies the generated SVG markup (skip silently if unavailable) | --copy 复制生成的 SVG 标记(不可用时静默跳过) |


Install · 安装

npx contrib-aquarium generate --user YOUR_LOGIN --out aquarium.svg

# or globally
npm i -g contrib-aquarium
contrib-aquarium generate --user YOUR_LOGIN --out aquarium.svg

Token optional. Without one, public events or a username-hash mock still render — demos never go blank.

没有 token 也能跑:公开 Events 或按用户名哈希的演示日历会顶上,预览不会空。

From source:

git clone https://github.com/webywz/contrib-aquarium.git
cd contrib-aquarium
npm install
npm run generate -- --user YOUR_LOGIN --out aquarium.svg

Quick start · 快速开始

# real calendar (needs token)
export GITHUB_TOKEN=ghp_...
npx contrib-aquarium generate --user webywz --out aquarium.svg

# recent public events only
npx contrib-aquarium generate --user webywz --source events --out aquarium.svg

# offline demo (byte-stable for a given UTC day)
npx contrib-aquarium generate --user webywz --source mock --out aquarium.svg

# theme
npx contrib-aquarium generate --user webywz --theme reef --out aquarium.svg

# list available themes
npx contrib-aquarium --list-themes
npx contrib-aquarium --list-themes --json

# copy the generated SVG markup to the clipboard (skip silently if unavailable)
npx contrib-aquarium generate --user webywz --source mock --copy

In a README:

<p align="center">
  <img src="aquarium.svg" width="860" alt="My contribution aquarium" />
</p>

Or a raw URL from another repo:

![aquarium](https://raw.githubusercontent.com/USER/REPO/main/aquarium.svg)

Data sources · 数据来源

--source auto (default) tries in order:

| Priority | Source | Token | Result | | --- | --- | --- | --- | | 1 | GraphQL contributionsCollection | yes (--token, GITHUB_TOKEN, or GH_TOKEN) | Full last-year calendar | | 2 | Public events GET /users/{login}/events/public | no | Recent activity (~90 days retained) | | 3 | Mock from username hash | no | Stable fake year for CI / demos / offline |

Pin a path with --source graphql|events|mock.

--source auto 按上表回退。GraphQL 要 token,拿完整贡献日历;公开 Events 不要 token,只有最近活动;mock 用用户名哈希生成确定假日历,保证离线 / CI / 演示出图。

Fine-grained or classic PAT that can read public user data is enough. In Actions, secrets.GITHUB_TOKEN covers public calendars.


How activity becomes an aquarium · 贡献如何变成鱼缸

| Signal | Becomes · 变成 | | --- | --- | | Yearly contribution total | School size 3–18 fish · 鱼数量 round(3 + sqrt(total) × 0.48) | | Busiest weeks | Larger koi / centerpiece angelfish · 更大锦鲤 / 主鱼 | | Current streak | Kelp height and count · 海藻高度与簇数 | | Last 14 days | Bubble density · 气泡密度 | | Each week's total | Pebble / reef bed · 沙地礁石起伏 | | Activity density | Water and plant motion · 水纹与海藻摆动 |

Empty years still get a few wanderers. Same username + calendar snapshot → same tank.

空年份仍有几条游鱼。同一用户名 + 同一日历快照,画出同一座缸。


Themes · 主题

--theme changes palette only — layout and activity mapping stay the same.

| Name | Feel · 观感 | | --- | --- | | deep (default) | Classic dark teal · 默认深青 | | reef | Warmer tropical water · 暖色珊瑚 | | midnight | Violet night, neon accents · 午夜紫 | | lagoon | Fresh green aquatic · 清新绿调 | | ember | Warm amber glow · 琥珀暖光 | | fog | Cool misty gray · 冷雾灰调 | | aurora | Cold northern-lights glow · 冷极光青紫 |

npx contrib-aquarium generate --user YOUR_LOGIN --theme midnight --out aquarium.svg
npx contrib-aquarium generate --user YOUR_LOGIN --theme ember --out aquarium.svg
npx contrib-aquarium generate --user YOUR_LOGIN --theme aurora --out aquarium.svg

Embed size · 嵌入尺寸

--width sets the SVG display width for README embeds. The internal viewBox stays 0 0 860 300, so fish and layout scale proportionally — never squash.

--width 只改 SVG 的展示宽;内部 viewBox 仍是 0 0 860 300,鱼和构图等比缩放,不会挤扁。

| Flag | Default | | | --- | --- | --- | | --width | 860 | Display width in px · 展示宽度 | | --height | proportional · 等比 | Display height; omit to keep aspect · 省略则保持比例 |

# Narrower card for a profile README · 主页 README 窄卡
npx contrib-aquarium generate --user YOUR_LOGIN --width 640 --out aquarium.svg

# Then embed without an extra HTML width attribute · 嵌入时不必再写 HTML width
# <img src="aquarium.svg" alt="My contribution aquarium" />

Static mode · 静态模式

--static (or --no-animate) strips all CSS animations and SMIL <animate> tags, so fish and plants rest in place. Useful for printing, email newsletters, or embedding where animations aren't wanted.

--static(或 --no-animate)移除所有 CSS 动画和 SMIL <animate> 标签,让鱼和海藻静止。适合打印、邮件简报,或不需要动画的嵌入场景。

# Static aquarium for print or email · 静态鱼缸,用于打印或邮件
npx contrib-aquarium generate --user YOUR_LOGIN --static --out aquarium-static.svg

# Works with all themes and sizes · 适用于所有主题和尺寸
npx contrib-aquarium generate --user YOUR_LOGIN --theme ember --static --width 640 --out static-ember.svg

Default behavior (without --static) includes full animations. The prefers-reduced-motion media query already pauses motion for users who request it, but --static removes animations entirely from the file.

默认行为(不加 --static)包含完整动画。prefers-reduced-motion 媒体查询已为需要的用户暂停动效,而 --static 则从文件中完全移除动画。


JSON output · JSON 输出

--json prints a machine-readable contribution summary to stdout instead of generating SVG. Useful for badge/CI pipelines that need stats without rendering. When used with --out, writes the JSON summary to the specified file with silent stdout.

--json 将机器可读的贡献摘要打印到标准输出,而不生成 SVG。适用于需要统计数据而无需渲染的徽章 / CI 管道。与 --out 一起使用时,将 JSON 摘要写入指定文件,标准输出保持静默。

# Get JSON summary to stdout · 获取 JSON 摘要到标准输出
npx contrib-aquarium generate --user webywz --json

# Write JSON summary to file · 将 JSON 摘要写入文件
npx contrib-aquarium generate --user webywz --json --out report.json

# Output includes · 输出包含:
# - login, name, totalContributions, source, range
# - streak (current consecutive days), activeDays (days with >0 contributions)
# - recent14 (last 14 days total), fishCount, plantCount, bubbleCount

Example output · 输出示例:

{
  "login": "webywz",
  "name": null,
  "totalContributions": 1234,
  "source": "graphql",
  "range": { "from": "2025-10-31", "to": "2026-10-30" },
  "streak": 42,
  "activeDays": 256,
  "recent14": 89,
  "fishCount": 12,
  "plantCount": 11,
  "bubbleCount": 15
}

When --json is set without --out, JSON is printed to stdout. With --out, the JSON is written to the specified file with silent stdout (nothing is written to disk in SVG mode). --theme, --width, --height, and --static have no effect in JSON mode.

设置 --json 时,不带 --out 则输出到标准输出;带 --out 则写入指定文件且标准输出保持静默(不写入 SVG)。--theme、--width、--height 和 --static 在 JSON 模式下无效。

--json and --html are mutually exclusive.

--json 与 --html 互斥,不能同时使用。


HTML report · HTML 报告

--html writes a self-contained offline HTML report (inline CSS + inlined SVG tank). No CDN, no external fonts or scripts — open it via file://.

--html 写出一份自包含离线 HTML 报告(内联 CSS + 内嵌 SVG 鱼缸)。无 CDN、无外部字体或脚本,可用 file:// 打开。

| Form · 写法 | Result · 结果 | | --- | --- | | --html | Print HTML to stdout · 打印到标准输出 | | --html report.html | Write HTML to that file · 写入指定文件 |

SVG still goes to --out (default aquarium.svg). --quiet still hides the pretty success line. --github annotations stay on stderr so stdout remains parseable HTML. --locale localizes report labels (JSON keys stay English).

SVG 仍写入 --out(默认 aquarium.svg)。--quiet 仍隐藏人类成功摘要行。--github 注解写到 stderr,stdout 保持可解析 HTML。--locale 本地化报告标签(JSON 键仍是英文)。

# HTML on stdout · HTML 到标准输出
npx contrib-aquarium generate --user webywz --source mock --html

# HTML to a file · HTML 写入文件
npx contrib-aquarium generate --user webywz --source mock --html report.html

# Combined with existing habits · 与现有习惯合用
npx contrib-aquarium generate --user webywz --source mock --out tank.svg --html report.html --quiet
npx contrib-aquarium generate --user webywz --source mock --html --github
npx contrib-aquarium generate --user webywz --source mock --html --locale zh

--html cannot be combined with --json (choose one primary export).

--html 不能与 --json 同时使用(请选择一种主输出)。


Clipboard · --copy

--copy copies the generated SVG markup — the same body written (or that would be written) to --out — to the system clipboard. It does not copy JSON, HTML chrome, or the pretty success line. If no clipboard tool is available (pbcopy / clip / wl-copy / xclip / xsel), the flag is skipped silently and the command still succeeds.

--copy 把生成的 SVG 标记(写入 / 本会写入 --out 的那份)复制到系统剪贴板。不会复制 JSON、HTML 外壳或人类成功摘要行。没有剪贴板工具(pbcopy / clip / wl-copy / xclip / xsel)时静默跳过,命令仍成功。

# SVG file + clipboard · 写文件并复制 SVG
npx contrib-aquarium generate --user webywz --source mock --out aquarium.svg --copy

# Still copies SVG, not JSON · 仍复制 SVG,不是 JSON
npx contrib-aquarium generate --user webywz --source mock --json --copy

# Still copies SVG, not the HTML report · 仍复制 SVG,不是 HTML 报告
npx contrib-aquarium generate --user webywz --source mock --html --copy

GitHub Actions · --github

--github emits GitHub Actions workflow commands: ::error:: on failures / usage errors, and one ::notice:: on a successful generate (user, theme, output path or JSON mode, fish/activity counts). Successful --list-themes also gets a notice. When GITHUB_STEP_SUMMARY is set, a short Markdown job summary is appended. Without --github, behavior is unchanged — no annotations, no job-summary writes.

--github 输出 GitHub Actions 工作流命令:失败 / 用法错误用 ::error::,成功 generate 打一条 ::notice::(用户、主题、输出路径或 JSON 模式、鱼数 / 贡献数)。成功的 --list-themes 同样打 notice。若设置了 GITHUB_STEP_SUMMARY,追加一段 Markdown Job Summary。不加 --github 时行为不变:无注解、不写 Job Summary。

Combined with --json or --html on stdout, stdout stays machine-parseable; annotations go to stderr. Combined with --quiet, the pretty human success line is still suppressed, but annotations and the job summary still emit.

与 --json 或 stdout 上的 --html 合用时,stdout 仍可解析,注解写到 stderr。与 --quiet 合用时仍隐藏人类成功摘要行,但注解和 Job Summary 照常输出。

# Actions annotations on stderr · 在 Actions 日志里打注解
npx contrib-aquarium generate --user YOUR_LOGIN --source mock --github

# JSON on stdout, notice on stderr · stdout 仍是 JSON
npx contrib-aquarium generate --user YOUR_LOGIN --json --github

Interface language · 界面语言

--locale controls the language for help text and terminal messages. Defaults to en.

--locale 控制帮助文本和终端消息的语言,默认 en。

# English interface (default)
npx contrib-aquarium --help

# Chinese interface
npx contrib-aquarium --help --locale zh

# Chinese error messages
npx contrib-aquarium generate --locale zh
# 缺少 --user <login>

JSON keys and values stay English regardless of --locale (machine contract).

JSON 键和值保持英文,不受 --locale 影响(机器契约)。


Embed daily · 每日嵌入

Copy examples/github-action.yml into your profile repo (USER/USER) as .github/workflows/aquarium.yml. It runs on a daily cron + workflow_dispatch, uses this repo as a composite action, and commits aquarium.svg when the tank changed.

# Pin a release tag — avoid @main.
- uses: webywz/[email protected]
  with:
    user: ${{ github.repository_owner }}
    out: aquarium.svg
    # theme: reef
    # width: 640
    # static: false

This project's demo refreshes the same way: .github/workflows/daily-aquarium.yml updates docs/aquarium.svg for webywz.

把示例 workflow 拷到个人主页仓库即可每天重画。GitHub Camo may cache the README thumbnail briefly after a push; the file in the repo is current.

GitHub 的 Camo 代理可能短暂缓存缩略图;仓库里的文件是新的。


CLI

contrib-aquarium generate --user <login> [--out aquarium.svg]
                          [--source auto|graphql|events|mock]
                          [--theme deep|reef|midnight|lagoon|ember|fog|aurora]
                          [--width <px>] [--height <px>]
                          [--static | --no-animate]
                          [--json]
                          [--html [path]]
                          [--token <gh_token>]
                          [--locale <en|zh>]
                          [--quiet]
                          [--github]
                          [--copy]

contrib-aquarium --list-themes [--json] [--locale <en|zh>] [--github]

| Flag | Default | | | --- | --- | --- | | --user | required | GitHub login | | --out | aquarium.svg | Output path (dirs created) | | --source | auto | See data sources | | --theme | deep | deep · reef · midnight · lagoon · ember · fog · aurora | | --width | 860 | Display width (viewBox fixed) · 展示宽 | | --height | proportional · 等比 | Display height · 展示高 | | --static | off | Strip animations; fish rest · 移除动画 | | --no-animate | off | Same as --static · 等同 --static | | --json | off | Print JSON to stdout; write to file with --out · 打印 JSON 到标准输出或与 --out 写入文件 | | --html | off | Self-contained HTML report to stdout, or --html <path> to a file · 自包含 HTML 到标准输出或写入路径 | | --token | $GITHUB_TOKEN / $GH_TOKEN | GraphQL auth | | --locale | en | Interface language: en or zh · 界面语言 | | --quiet | off | Suppress success summary · 关闭成功摘要 | | --github | off | Actions annotations (::error:: / ::notice::) + job summary · Actions 注解与 Job Summary | | --copy | off | Copy the generated SVG markup to the clipboard; skip silently if unavailable · 复制 SVG 标记到剪贴板(不可用则跳过) | | --list-themes | off | Print available themes (one per line; with --json: JSON array) · 打印可用主题 |

npm run generate -- --user webywz --out docs/aquarium.svg
npm test
npm run build
npm run lint

Library · 库

import { generateAquarium, renderAquarium, mockActivity } from "contrib-aquarium";

const { svg, activity } = await generateAquarium({
  user: "webywz",
  source: "auto",
  theme: "reef",
});

const svgFromMock = renderAquarium(mockActivity("webywz", new Date("2026-10-29")));

// Narrower embed · 窄嵌入(viewBox 仍 860×300)
const narrow = renderAquarium(mockActivity("webywz"), "deep", { width: 640 });

Also exported: loadActivity, fetchGraphqlActivity, fetchEventsActivity, getTheme, parseTheme, THEME_NAMES, resolveSvgDisplaySize, and size helpers. Types ship with the package.

另导出活动加载、主题解析、resolveSvgDisplaySize 与尺寸常量;TypeScript 类型随包发布。


Links · 链接