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

@ken0106/core

v0.1.0-alpha.0

Published

Pure-TS kernel for paleta: sniff, quantize (Wu), OKLab, cache pipeline.

Readme

@ken0106/core

The pure-TS kernel for paleta — correct image-format sniffing, Wu color quantization, OKLab color math, and an edge-ready palette-extraction pipeline. Bring your own decoder.

npm install @ken0106/core

Status

pre-alpha — APIs may break before v1.0.0. Pin the version you test against.

Quick start

import { getPalette, initWasm } from "@ken0106/core";
import { readFile } from "node:fs/promises";

// Rust WASM quantizer (optional — pure-JS fallback runs without it).
await initWasm(await readFile(
  new URL("@ken0106/core/wasm", import.meta.url),
));

const result = await getPalette(bytes, {
  decoder: myDecoder,   // ArrayBuffer → { data: RGBA, width, height }
  colorCount: 8,
});

result.palette;    // [[r, g, b], …]  sorted by perceptual dominance
result.dominant;   // [r, g, b]
result.oklch;      // [[L, C, H], …]  OKLCH for each palette entry
result.meta.path;  // "full-decode" | "exif-thumb" | "dc-only" | "cache-hit"

On a Cloudflare Worker, use the CompiledWasm rule and pass the module directly to initWasm:

// wrangler.jsonc: [[rules]] type = "CompiledWasm", globs = ["**/*.wasm"]
import paletaWasm from "<relative path to>/paleta_core_bg.wasm";
await initWasm(paletaWasm as WebAssembly.Module);

What's in the box

| Export | Purpose | |---|---| | getPalette(source, opts) | Pipeline: sniff → cache → decode → resize → quantize → sort | | getColor(source, opts) | Convenience — returns the dominant color only | | pickAccent(palette, bg, opts) | WCAG-aware accent picker ("#hex" or [r,g,b]) | | decodeJpegDcOnly(bytes) | Experimental: 4–12× faster JPEG decode via DC coefficients | | sniffFormat(bytes) | Correct magic-byte detection for PNG / JPEG / WebP / AVIF | | quantizeWu(hist, n) | Wu quantizer over a 5-bit RGB histogram | | initWasm(source) | Load the SIMD-accelerated Rust quantizer (optional) | | rgbToOKLab, contrastRatio, … | OKLab / OKLCH / WCAG color math |

Full API: the TypeScript .d.ts files under dist/.

Decoders

@ken0106/core is decoder-agnostic. You pass a DecodeFn for each format you support. The companion package @ken0106/jsquash provides jSquash-backed decoders for JPEG/PNG/WebP/AVIF:

import { autoDecoders } from "@ken0106/jsquash";
await getPalette(url, { decoders: autoDecoders(), … });

Why

Full writeup, benchmarks, and examples at github.com/Kenth06/paleta.

License

MIT