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

@pawn002/klar-plugin-interface

v1.0.1

Published

Shared ContrastPlugin interface for klar plugins

Readme

@pawn002/klar-plugin-interface

The shared TypeScript contract every klar contrast-algorithm plugin implements: the ContrastPlugin interface.

This package is types only — it ships an interface and no runtime code. A plugin declares it as a types-only devDependency; the compiled JavaScript has no runtime dependency on it.

Install

npm install --save-dev @pawn002/klar-plugin-interface

The contract

import type { ContrastPlugin } from '@pawn002/klar-plugin-interface';

export const MyMetric: ContrastPlugin = {
  id: 'mymetric',            // unique; becomes --type <id> in the CLI
  displayName: 'My Metric',  // shown by `klar plugins list`
  description: 'One line on what it measures and its range.',
  // unit?: 'px',            // optional; for category 'dimension'
  // category?: 'contrast',  // 'contrast' (default) | 'dimension'
  calculate(colorOne, colorTwo) {
    // colorOne/colorTwo are CSS color strings (hex, rgb(), oklch(), …)
    // return a number, or null if the input can't be handled
    return 0;
  },
};

export default MyMetric;

| Member | Type | Notes | |---|---|---| | id | string | Unique, URL-safe; the --type value. Must not collide with built-ins (okca, wcag2, deltaE). | | displayName | string | Human-readable name. | | description | string | One-sentence summary (range, licensing notes). | | unit? | string | Unit label (e.g. 'px'); omit for dimensionless values. | | category? | 'contrast' \| 'dimension' | Defaults to 'contrast'. | | calculate | (a, b) => number \| null | Returns the value, or null on unparseable input — return null, don't throw. |

How a plugin gets used

Publish a package named klar-plugin-<id> that exports a ContrastPlugin. klar discovers installed klar-plugin-* packages by naming convention at runtime and exposes each as --type <id> — no registration in klar itself.

Full architecture + authoring guide: pawn002/klar-plugins. Plugin trust model: klar SECURITY.md.

License

MIT