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

@driangle/kleur

v0.1.1

Published

A cross-language color manipulation library

Readme

@driangle/kleur

A TypeScript color manipulation library. Create, convert, analyze, and transform colors with an immutable, chainable API.

Documentation

Install

npm install @driangle/kleur

Quick Start

import kleur from "@driangle/kleur";

// Create colors from any format
const color = kleur("#ff6600");
const fromRgb = kleur.rgb(66, 135, 245);
const fromHsl = kleur.hsl(217, 90, 61);
const fromCss = kleur.css("rebeccapurple");

// Manipulate (returns new instances)
color.lighten(0.2);
color.darken(0.3);
color.saturate(0.5);
color.rotate(45);
color.withAlpha(0.8);

// Output in any format
color.toHex();   // "#ff6600"
color.toRgb();   // { r: 255, g: 102, b: 0 }
color.toHsl();   // { h: 24, s: 100, l: 50 }
color.toCss();   // "rgba(255,102,0,1)"
color.toHex8();  // "#ff6600ff"

Features

Color Creation

kleur("#ff6600");           // hex (3, 4, 6, or 8 digit)
kleur.rgb(255, 102, 0);    // RGB values
kleur.hsl(24, 100, 50);    // HSL values
kleur.css("coral");         // CSS named colors
kleur.int(0xff6600);        // integer
kleur.grayscale(128);       // grayscale value
kleur.random();             // random color

Manipulation

All methods are immutable and return a new Color instance.

const c = kleur("#3388ff");

// Adjustments
c.lighten(0.2);       // lighten by 20% of remaining headroom
c.darken(0.3);        // darken by 30% of current lightness
c.saturate(0.5);      // increase saturation
c.desaturate(0.2);    // decrease saturation
c.rotate(90);         // rotate hue by degrees
c.complement();       // rotate 180 degrees
c.invert();           // invert RGB channels
c.grayscale();        // remove saturation
c.warm(0.3);          // shift hue toward warm
c.cool(0.3);          // shift hue toward cool

// Direct channel control
c.withRed(200);
c.withHue(180);
c.withAlpha(0.5);
c.adjustHue(30);
c.scaleLightness(1.2);

Color Harmony

Harmony methods return a Palette (an iterable array-like of colors).

const c = kleur("#ff6600");

c.triadic();              // 3 colors, 120 degrees apart
c.tetradic();             // 4 colors, 90 degrees apart
c.analogous();            // 3 neighboring colors
c.splitComplement();      // split-complementary
c.tints(5);               // 5 lighter variations
c.shades(5);              // 5 darker variations
c.tones(5);               // 5 desaturated variations

Blending & Mixing

const a = kleur("#ff0000");
const b = kleur("#0000ff");

// Mix two colors
a.mix(b, 0.5);                     // 50% blend
a.mix(b, 0.5, t => t * t);         // with easing

// Blend modes
a.blend(b, "multiply");
a.blend(b, "screen");
a.blend(b, "overlay");

Analysis

const c = kleur("#3388ff");

kleur.luminance(c);                  // relative luminance (0-1)
kleur.contrast(c, kleur.white);      // contrast ratio
kleur.isLight(c);                    // true if light
kleur.isDark(c);                     // true if dark
kleur.distance(c, kleur("#0066cc")); // perceptual distance

Gradients

import { LinearGradientBuilder } from "@driangle/kleur";

const gradient = new LinearGradientBuilder()
  .stop("#ff0000", 0)
  .stop("#0000ff", 1)
  .build(90);

Palette Utilities

const palette = kleur("#ff6600").triadic();

palette.sortBy("hue");
palette.unique();
palette.spread(7);
palette.interpolate(10);
palette.harmonize(0.5);
palette.balanceLightness(50);
palette.flatMap(c => [c, c.lighten(0.3)]);

Output Formats

const c = kleur("#ff6600");

c.toHex();        // "#ff6600"
c.toHex8();       // "#ff6600ff"
c.toRgb();        // { r: 255, g: 102, b: 0 }
c.toRgba();       // { r: 255, g: 102, b: 0, a: 1 }
c.toHsl();        // { h: 24, s: 100, l: 50 }
c.toHsla();       // { h: 24, s: 100, l: 50, a: 1 }
c.toHsb();        // { h: 24, s: 100, b: 100 }
c.toHsba();       // { h: 24, s: 100, b: 100, a: 1 }
c.toCss();        // "rgba(255,102,0,1)"
c.toArray();      // [255, 102, 0, 1]
c.toNormalized(); // [1, 0.4, 0, 1]

License

MIT