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

cie.js

v1.0.33

Published

Node wrapper around CIE.sh.

Readme

cie.js

GitHub npm npm type definitions install size Document
Npm Publish Docker Publish
Maintainability codecov DeepScan grade jest
Node.js wrapper around CIE.sh.

📕 TOC

📃 About

This package calculates the color difference between two colors using the color difference formula in LAB Delta E established by the Commission internationale de l'éclairage (CIE).
It also uses Bash Script for the main logic, so the following is required to run it.

📦 Dependencies

  • bash >= 5.0
  • grep
  • awk
  • sed
  • cat
  • bc

🛠 Usage

🖥 CLI

$ yarn global add cie.js  # npm install -g cie.js

$ cie-js -h
Usage: cie-js [options] [command]

Derives the color difference using the method defined by LAB Delta E (CIE76, CIE94, CIEDE2000).

Options:
  -v, --version   Output the version number
  -h, --help      display help for command

Commands:
  dE76            Use the CIE 1976 color difference formula.
  dE94            Use the CIE 1994 color difference formula.
  dE00            Use the CIEDE2000 color difference formula.
  help [command]  display help for command

TL;DR
  $ cie-js dE76 50.0000 2.6772 \ -79.7751 50.0000 0.0000 \ -82.7485
  $ cie-js dE94 -g 50.0000 2.6772 \ -79.7751 50.0000 0.0000 \ -82.7485
  $ cie-js dE00 50.0000 2.6772 \ -79.7751 50.0000 0.0000 \ -82.7485
  $ echo 50.0000,2.6772,-79.7751,50.0000,0.0000,-82.7485 | cie-js dE94 -t

$ cie-js dE76 50.0000 2.6772 \ -79.7751 50.0000 0.0000 \ -82.7485
4.0011
$ cie-js dE94 -g 50.0000 2.6772 \ -79.7751 50.0000 0.0000 \ -82.7485
1.3950
# Read from file
$ cat example.txt
50.0000 2.6772 -79.7751 50.0000 0.0000 -82.7485
50.0000 3.1571 -77.2803 50.0000 0.0000 -82.7485
50.0000 2.8361 -74.0200 50.0000 0.0000 -82.7485
50.0000 -1.3802 -84.2814 50.0000 0.0000 -82.7485
50.0000 -1.1848 -84.8006 50.0000 0.0000 -82.7485
50.0000 -0.9009 -85.5211 50.0000 0.0000 -82.7485

$ cat example.txt | cie-js dE76
4.0011
6.3142
9.1777
2.0627
2.3696
2.9153

🐳 CLI by Docker

# Install
$ docker pull ghcr.io/redpeacock78/cie.js

# Write the following function in .bashrc etc.
cie-js() {
  [[ -t 0 ]] && T="t" || T=""
  docker run -i"${T}" --rm ghcr.io/redpeacock78/cie.js:latest "${@}"
}

# Run!
$ source ~/.bashrc
$ cie-js dE76 50.0000 2.6772 \ -79.7751 50.0000 0.0000 \ -82.7485
4.0011

# Update
$ docker pull ghcr.io/redpeacock78/cie.js && docker rmi -f $(docker images | grep ghcr.io/redpeacock78/cie.js | grep none | awk '{print $3}')

# Uninstall
$ docker rmi -f $(docker images | grep ghcr.io/redpeacock78/cie.js | grep latest | awk '{print $3}')

📄 Javascript

import * as lab from 'cie.js'; // const lab = require('cie.js');

const color_1 = { L: 50.0000, a: 50.0000, b: 0.0000 };
const color_2 = { L: 40.0000, a: 50.0000, b: 0.0000 };
(async () => {
  await lab.dE76(color_1, color_2).then((result) => {
    console.log(result);
  })
})();
// => 10.0000

🔗 API

1976 Formula

The CIE 1976 color difference formula is the first color difference formula defined, and is calculated as the Euclidean distance in CIELAB coordinates.

  • lab.dE76(color_1: {[key: string]: number}, color_2: {[key: string]: number}): Promise<string>
    const color_1 = { L: 50.0000, a: 2.6772, b: -79.7751 };
    const color_2 = { L: 50.0000, a: 0.0000, b: -82.7485 };
    (async () => {
      console.log(await lab.dE76(color_1, color_2));
    })();
    // => 4.0011

1994 Formula

ΔE(1994) is calculated from the difference in brightness, saturation, and hue in the L*C*h* color space, which is calculated from the L*a*b* color space. It also introduces a weighting factor for specific applications, derived from the allowable values for automotive paints.

  • lab.dE94.textile(color_1: {[key: string]: number}, color_2: {[key: string]: number}): Promise<string>
    const color_1 = { L: 50.0000, a: 2.6772, b: -79.7751 };
    const color_2 = { L: 50.0000, a: 0.0000, b: -82.7485 };
    (async () => {
      console.log(await lab.dE94.textile(color_1, color_2));
    })();
    // => 1.4230
  • lab.dE94.graphicArts(color_1: {[key: string]: number}, color_2: {[key: string]: number}): Promise<string>
    const color_1 = { L: 50.0000, a: 2.6772, b: -79.7751 };
    const color_2 = { L: 50.0000, a: 0.0000, b: -82.7485 };
    (async () => {
      console.log(await lab.dE94.graphicArts(color_1, color_2));
    })();
    // => 1.3950

2000 Formula

Since the CIE 1994 definition did not sufficiently ensure perceived uniformity, the CIE revised the definition and established the standard.

  • lab.dE00(color_1: {[key: string]: number}, color_2: {[key: string]: number}): Promise<string>
    const color_1 = { L: 50.0000, a: 2.6772, b: -79.7751 };
    const color_2 = { L: 50.0000, a: 0.0000, b: -82.7485 };
    (async () => {
      console.log(await lab.dE00(color_1, color_2));
    })();
    // => 2.0425

🎉 Acknowledgements

🥝 Lisence

MIT