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

contrastcheck

v1.2.0

Published

Check color contrast accessibility on websites

Readme

ContrastCheck

Check color contrast accessibility on websites using real browser rendering.

Install

npm install -g contrastcheck
# or
bun install -g contrastcheck

Or run directly with npx:

npx contrastcheck <url>

Usage

Quick check

contrastcheck https://example.com

The tool accepts URLs, local HTML files, or any file path:

contrastcheck ./index.html
contrastcheck https://localhost:3000
contrastcheck ../dist/index.html

Commands

| Command | Description | |---------|-------------| | check <url> | Check a single URL for contrast issues | | wizard | Interactive setup wizard | | help | Show help |

Options

| Option | Default | Description | |--------|---------|-------------| | -o, --output <path> | ./contrast-report.html | Output path for HTML report | | --no-headless | headless | Show browser window during scan | | -w, --viewport <wxh> | 1280x720 | Viewport size | | --dark-mode | false | Force dark mode preference | | -f, --format <type> | html | Output format: html, json, compact | | --json | false | Output JSON to stdout instead of HTML report | | -q, --quiet | false | Minimal output (no spinners, progress bars) | | --all | false | Include passing elements in output (default shows failures only) | | --watch | false | Watch for file changes and re-check automatically |

Examples

# Generate an HTML report
contrastcheck https://example.com -o report.html

# Check in dark mode with mobile viewport
contrastcheck https://example.com --dark-mode -w 390x844

# Output JSON to stdout (failures only by default)
contrastcheck https://example.com --json
# or
contrastcheck https://example.com -f json

# Include all results (passes + failures)
contrastcheck https://example.com -f json --all

# Watch a local file for changes
contrastcheck ./index.html --watch

# Run with visible browser window
contrastcheck https://example.com --no-headless

# Minimal output for CI
contrastcheck https://example.com -q -f compact

Interactive wizard

contrastcheck wizard

Guides you through URL, viewport, dark mode, headless, and output options.

How it works

  1. Launch a real browser (Playwright Chromium) and load the target page
  2. Extract rendered colors for every visible text element, accounting for CSS, inline styles, inheritance, transparency, and background images
  3. Calculate WCAG contrast ratios using the standard relative luminance formula
  4. Flag violations against AA and AAA thresholds:
    • Normal text: AA ≥ 4.5, AAA ≥ 7
    • Large text (18.66px+ bold or 24px+): AA ≥ 3, AAA ≥ 4.5
  5. Suggest fixes by shifting foreground colors to meet the failing threshold
  6. Generate a report with screenshots of each violation

Output formats

By default, all formats show only failures to keep output focused. Use --all to include passing elements.

  • HTML (default): Report with violation list, screenshots, and fix suggestions
  • JSON: Machine-readable output with analyzed pairs and metadata
  • Compact: One-line summary for CI/logs

Report

The HTML report includes:

  • Summary of pass/fail counts (AA & AAA)
  • List of violations with contrast ratios
  • Suggested color fixes
  • Screenshots of failing elements

Requirements

  • Node.js 18+ or Bun
  • Playwright will download Chromium on first run

Contributing & Releasing

CI

Every PR and push to main runs type-checking, tests, and a build via GitHub Actions.

Releasing a new version

We use Nyron for automated changelogs and releases.

  1. Bump the version and generate changelog

    bun run bump -- --type patch   # or minor / major
  2. Commit the generated changes

    git add . && git commit -m "chore: release v$(node -p "require('./package.json').version")"
  3. Push the release boundary tag

    bun run push-tag
  4. GitHub Actions takes over

    • Publishes the package to npm automatically
    • Creates a GitHub Release with auto-generated changelog via Nyron

Preview a release locally

bun run release:dry

Required secrets

Add an NPM_TOKEN secret in your repo settings (Settings → Secrets and variables → Actions):

  • Generate a granular access token on npm with Publish permission for contrastcheck and Bypass 2FA enabled.

License

ISC