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

@readytools/colors

v1.1.0

Published

Modern zero-dependency color conversion, contrast checking, Tailwind palette generation, and perceptual color tools for frontend designers by ReadyTools.

Readme

@readytools/colors

Modern color utilities for UI engineers: conversions, accessibility, OKLCH ramps, Tailwind palettes, and CSS-ready output in one zero-dependency ESM package.

Full documentation: https://www.readytools.co/docs/colors/

🟧 #ff6600 🟪 #8b5cf6 🟦 #06b6d4 🟩 #22c55e

npm install @readytools/colors
import {
  getContrastColor,
  generateTailwindPalette,
  scale,
  toCSS
} from "@readytools/colors";

Why This Library?

  • Zero dependencies, ESM-only, tree-shake friendly.
  • Built for real frontend workflows: tokens, themes, palettes, CSS output.
  • Modern color spaces: Lab, OKLab, OKLCH, CIEDE2000.
  • Accessibility helpers: WCAG contrast, readable text color, contrast fixing.
  • Tailwind-ready palette and config generators.

Quick Examples

Tailwind Palette

import { generateTailwindPalette } from "@readytools/colors";

const brand = generateTailwindPalette("#ff6600");

console.log(brand[50]);  // "#ffe6cf"
console.log(brand[500]); // "#ff6600"
console.log(brand[950]); // "#220000"

Tailwind Config

import { generateTailwindConfig } from "@readytools/colors";

export default {
  content: ["./src/**/*.{js,ts,jsx,tsx}"],
  ...generateTailwindConfig("#ff6600", { name: "brand" })
};

Accessible Text

import { getContrastColor, ensureContrast } from "@readytools/colors";

const bg = "#ff6600";
const text = getContrastColor(bg);
const aaaText = ensureContrast("#888888", "#ffffff", 7);

Perceptual Color Ramp

import { scale } from "@readytools/colors";

const ramp = scale("#ff6600", "#0066ff", 7, { space: "oklch" });

Modern CSS Output

import { toCSS } from "@readytools/colors";

toCSS("#ff6600", "color", "oklch");
// "color: oklch(69.58% 0.2043 43.49);"

Parse Modern CSS Colors

import { parseColor } from "@readytools/colors";

parseColor("oklch(69.58% 0.2043 43.49 / 80%)");
// { format: "oklch", value: { L: 0.6958, C: 0.2043, h: 43.49, alpha: 0.8 } }

API Map

Conversions: hexToRgb, rgbToHex, rgbToHsl, hslToRgb, hexToCmyk, rgbToXyz, xyzToLab, rgbToLab, labToRgb, rgbToOklab, oklabToRgb, hexToOklab, oklabToHex, rgbToOklch, oklchToRgb, hexToOklch, oklchToHex

Accessibility: luminance, contrastRatio, isAccessible, getContrastColor, ensureContrast

Adjustments: lighten, darken, saturate, desaturate, adjustHue, invert, mix

Generation: random, randomColor, interpolate, scale, generateShades, generateTints, generateTones, generateHueVariants, generateShadeScale, generateTailwindPalette, generateTailwindConfig

Parsing and output: isValidHex, normalizeHex, parseColor, hexAToRgba, rgbaToHexA, toCSS

Palettes and difference: complementary, analogous, triadic, tetradic, deltaE76, deltaE2000

TypeScript

Types are bundled.

import { hexToOklch, generateTailwindPalette, type Oklch } from "@readytools/colors";

const color: Oklch = hexToOklch("#ff6600");
const palette = generateTailwindPalette("#ff6600");

Notes

  • Node/browser compatible wherever ESM is supported.
  • CommonJS require() is not supported directly.
  • Full API documentation: https://www.readytools.co/docs/colors/

License

MIT © ReadyTools