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

github-contribution-svg

v0.1.0

Published

Zero-dependency React component that renders a GitHub contribution calendar as a crisp inline SVG, themeable with CSS custom properties.

Readme

github-contribution-svg

npm CI zero dependencies

A GitHub contribution calendar as a crisp inline SVG for React. Zero dependencies, themeable with plain CSS custom properties, SSR-friendly, and happy to render data you fetched yourself.

Live on adnanreza.com in both light and dark themes.

| Light | Dark | | --- | --- | | Light theme | Dark theme |

Why another one?

react-github-calendar is excellent and more featureful — use it if you want labels, legends, and options. This package is the minimalist take: one component, no dependencies, no shipped stylesheet, cells styled by CSS variables so the chart inherits your design tokens (including dark mode) with no theme objects or filters.

Install

npm install github-contribution-svg

React ≥ 18 is a peer dependency.

Quick start

import { ContributionGraph } from "github-contribution-svg";

// Convenience mode: fetches the last year client-side (no token needed)
<ContributionGraph username="octocat" />

The SVG scales to its container (it only sets a viewBox), so size it with CSS. Until data arrives it renders null — reserve space with aspect-ratio if you want zero layout shift: 52 weeks at default geometry is 673 / 88.

Bring your own data (SSR / one fetch for chart + total)

import { ContributionGraph, fetchContributions } from "github-contribution-svg";

const { contributions, totalLastYear } = await fetchContributions("octocat");

<figure>
  <ContributionGraph data={contributions} />
  <figcaption>{totalLastYear} contributions in the last year</figcaption>
</figure>

data mode makes no network request, so it works in server components, static builds, or with data from your own proxy.

Theming

Cells fill from var(--gcs-cell-{level}, <github-green default>) and carry the classes gcs-cell gcs-l0 … gcs-l4. Define five custom properties and the chart is yours:

.my-chart {
  --gcs-cell-0: oklch(90% 0.008 240);   /* no contributions */
  --gcs-cell-1: oklch(80% 0.055 245);
  --gcs-cell-2: oklch(68% 0.095 245);
  --gcs-cell-3: oklch(55% 0.125 245);
  --gcs-cell-4: oklch(41% 0.13 245);    /* most contributions */
}
[data-theme="dark"] .my-chart {
  --gcs-cell-0: oklch(26% 0 0);
  --gcs-cell-4: oklch(79% 0.1 245);     /* brightest = most active */
  /* ... */
}

No JavaScript theme objects, no filter: invert() hacks — dark mode is just different variables.

Responsive recipe

A full year squeezed into a phone screen means ~4px cells. Render two instances and let a media query pick one:

<ContributionGraph data={days} weeks={52} className="chart chart--full" />
<ContributionGraph data={days} weeks={26} className="chart chart--half" />
.chart--half { display: none; }
@media (max-width: 640px) {
  .chart--full { display: none; }
  .chart--half { display: block; }
}

Props

| Prop | Default | Description | | --- | --- | --- | | data | — | ContributionDay[] ({date, count, level}), date-ascending. Disables fetching. | | username | — | GitHub username; fetches the last year client-side. | | url | jogruber.de API | Endpoint template for username mode; {username} is substituted. | | weeks | 52 | Trailing weeks to render. | | cellSize / gap / radius | 10 / 3 / 2 | Geometry in SVG units. | | tooltips | true | Native per-cell <title> tooltips. | | ariaLabel | derived | Accessible label for the role="img" SVG. | | className | — | Class on the <svg>. |

Also exported: buildWeeks(days) (Sunday-start week bucketing) and fetchContributions(username, {url, signal}).

Data source & credits

Username mode uses the free community github-contributions-api by @grubersjoe, which reads the public profile calendar — please be considerate with request volume, and point url at a self-hosted instance for anything high-traffic.

License

MIT © Adnan Reza