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 🙏

© 2025 – Pkg Stats / Ryan Hefner

saltcat-color-tokens

v0.4.0

Published

User-friendly wrapper around saltcat-color-palette for parsing Tailwind-style color tokens with advanced grading and LUT controls.

Readme

saltcat-color-tokens

User-friendly wrapper around saltcat-color-palette for parsing Tailwind-style color tokens with advanced grading and LUT controls.

Installation

npm install saltcat-color-tokens

Usage

Basic Color Token Parsing

import { parseColorToken } from 'saltcat-color-tokens';

// Parse Tailwind-style color tokens
const blue500 = parseColorToken('blue-500');    // Returns hex color
const red300 = parseColorToken('red-300');      // Returns hex color
const black = parseColorToken('black');         // Returns #000000
const white = parseColorToken('white');         // Returns #ffffff

Get All Shades of a Color

import { getShades } from 'saltcat-color-tokens';

const blueShades = getShades('blue');
// Returns: { 50: '#...', 100: '#...', ..., 900: '#...' }

Configuration

Configure color grading and brightness controls:

import { configure } from 'saltcat-color-tokens';

configure({
  minBrightness: 0.1,
  maxBrightness: 0.9,
  grading: {
    red: { lift: 0.1, gamma: 1.2, gain: 1.0 },
    green: { lift: 0, gamma: 1.0, gain: 1.1 },
    blue: { lift: 0, gamma: 1.0, gain: 0.9 }
  }
});

Node.js Configuration File

In Node.js environments, you can create a saltcat-color-tokens.mjs file in your project root:

// saltcat-color-tokens.mjs
export default {
  minBrightness: 0.05,
  maxBrightness: 0.95,
  grading: {
    luminance: { lift: 0, gamma: 1.1, gain: 1 }
  },
  lut: './path/to/your/lut.cube'
};

Supported Colors

All standard Tailwind CSS colors are supported:

  • Grays: slate, gray, zinc, neutral, stone
  • Colors: red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose
  • Special: black, white

Shades

Standard Tailwind shades: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900

Features

  • Color Grading: Advanced lift/gamma/gain controls for fine-tuning colors
  • Brightness Clamping: Ensure colors stay within specified brightness ranges
  • LUT Support: Apply 3D lookup tables in Node.js environments (requires saltcat-color-palette)
  • Environment Detection: Automatic Node.js vs browser detection
  • Configuration: Flexible configuration system with file-based config support

API

parseColorToken(token: string): string

Parses a Tailwind-style color token and returns a hex color string.

  • token - Color token in format "color-shade" (e.g., "blue-500") or "black"/"white"

getShades(colorName: string): object

Returns an object with all shades (50-900) for a given color name.

  • colorName - Name of the color (e.g., "blue", "red")

configure(config: object): void

Updates the global configuration.

  • config.minBrightness - Minimum brightness clamp (0-1)
  • config.maxBrightness - Maximum brightness clamp (0-1)
  • config.grading - Color grading controls
  • config.lut - Path to LUT file (Node.js only)

defaultConfig

The default configuration object.

Scripts

  • npm run build - Build distribution files
  • npm run test - Run tests
  • npm run test:watch - Run tests in watch mode
  • npm run test:coverage - Run tests with coverage
  • npm run dev - Run development version

Dependencies

  • colorjs.io - Advanced color manipulation
  • chroma-js - Color scale generation
  • saltcat-color-palette - Core color grading and LUT functionality

License

MIT