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

@quieto/engine

v0.1.1

Published

Pure TypeScript color engine for OKLCH-based palette generation. Handles color parsing, perceptually even ramp generation, gamut mapping, WCAG contrast calculation, and export to CSS custom properties or JSON.

Downloads

35

Readme

@quieto/engine

Pure TypeScript color engine for OKLCH-based palette generation. Handles color parsing, perceptually even ramp generation, gamut mapping, WCAG contrast calculation, and export to CSS custom properties or JSON.

Installation

npm install @quieto/engine

API

parseColor(input: string)

Parses Hex, RGB, HSL, or HSB color strings into OKLCH.

import { parseColor } from '@quieto/engine';

const result = parseColor('#2563EB');
// { ok: true, value: { l: 0.5418, c: 0.2059, h: 264.05 } }

generateRamp(options)

Generates an OKLCH lightness ramp from a seed color. Supports linear and eased distribution modes. The seed color is always anchored as an exact step.

import { generateRamp, parseColor } from '@quieto/engine';

const seed = parseColor('#2563EB').value;
const ramp = generateRamp({ seed, steps: 10 });
// ramp.steps -> 10 RampStep objects with hex, rgb, hsl, hsb, oklch values

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | seed | OklchColor | required | Seed color in OKLCH | | steps | number | 10 | Number of ramp steps (1-100) | | name | string | 'color' | Ramp name | | distribution | 'linear' \| 'eased' | 'linear' | Lightness distribution mode | | rangeMin | number | 0.05 | Lightness floor (0-1) | | rangeMax | number | 0.97 | Lightness ceiling (0-1) |

calculateContrast(color1, color2)

Computes WCAG 2.x contrast ratio between two OKLCH colors.

import { calculateContrast } from '@quieto/engine';

const result = calculateContrast(colorA, colorB);
// { ratio: 4.72, aa: true, aaa: false, aaLarge: true, aaaLarge: true }

isInGamut(color) / mapToGamut(color)

Checks whether an OKLCH color fits within sRGB, and perceptually maps out-of-gamut colors back in using chroma reduction.

exportCSS(palette, options)

Generates CSS custom properties with Tailwind-style numeric naming (50-900, light to dark).

import { exportCSS } from '@quieto/engine';

const css = exportCSS({ ramps: [ramp] }, { naming: 'numeric' });
// :root {
//   --color-blue-50: #e0edff;
//   ...
//   --color-blue-900: #0a1a3a;
// }

exportJSON(palette)

Generates a JSON representation of the palette with all color formats per step and WCAG contrast data for all within-ramp pairs.

import { exportJSON } from '@quieto/engine';

const json = exportJSON({ ramps: [ramp] });
// { ramps: [{ name, steps: [...] }], contrast: [{ pair, ratio, aa, aaa, ... }] }

serializeState(palette) / deserializeState(encoded)

Compresses palette configuration to a URL-safe base64url string for shareable links. Handles UTF-8, CJK, and emoji in ramp names.

Color Conversion Utilities

  • oklchToHex(color) - OKLCH to hex string
  • oklchToRgb(color) - OKLCH to RGB object
  • oklchToHsl(color) - OKLCH to HSL object
  • oklchToHsb(color) - OKLCH to HSB object
  • clampOklchValues(color) - Clamp OKLCH values to valid ranges

License

MIT