
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
The best modern way to quantify the difference between two colors is by using the Delta E (ΔE) formulas. These formulas calculate the perceptual difference between two colors in the CIELAB (LAB) color space, which is designed to be more aligned with human vision. These algorithms represent the hard work of the International Commission on Illumination (CIE).
The source code is written to be as performant as possible and will likely outperform other packages. This is achieved by:
% instead of if else statements)x * x instead of Math.pow(x, 2))npm i deltae-js
# or
pnpm add deltae-js
# or
bun add deltae-js
import { getDeltaE_CIE76, getDeltaE_CMC, getDeltaE_CIE94, getDeltaE_CIEDE2000, type LAB } from 'deltae-js'
// Create two LAB colors to compare
const x1: LAB = [36, 60, 41]
const x2: LAB = [100, 40, 90]
// 1976 formula
getDeltaE_CIE76(x1, x2)
// 1984 formula
getDeltaE_CMC(x1, x2)
// 1994 formula
getDeltaE_CIE94(x1, x2)
// 2000 formula
getDeltaE_CIEDE2000(x1, x2)
import type { CMC, CIE94, CIEDE2000 } from 'deltae-js'
const weights_CMC: CMC = {
lightness: 1.35,
chroma: 1.5,
}
getDeltaE_CMC(x1, x2, weights_CMC)
const weights_CIE94: CIE94 = {
lightness: 2, // 1 = Graphic Arts | 2 = Textiles
chroma: 1.25,
hue: 1.5,
}
getDeltaE_CIE94(x1, x2, weights_CIE94)
const weights_CIEDE2000: CIEDE2000 = {
lightness: 1.25,
chroma: 1.5,
hue: 1.75,
}
getDeltaE_CIEDE2000(x1, x2, weights_CIEDE2000)
CIELAB (commonly referred to as LAB) is a perceptually uniform color space defined by the International Commission on Illumination (CIE). Unlike RGB, which is device-dependent, LAB is device-independent and designed to approximate human vision.
In the LAB model:
Because LAB is perceptually uniform, the numerical distance between two colors in this space better reflects how different they appear to the human eye. This makes LAB particularly suitable for:
To convert colors from RGB (or other formats) to LAB, you can use the color-convert package:
npm i color-convert
# or
pnpm add color-convert
# or
bun add color-convert
The getDeltaE_fromRGB function returns the ΔE of the input RGB colors.
import convert, { type RGB, type LAB } from 'color-convert'
import { getDeltaE_CIEDE2000 } from 'deltae-js'
const getDeltaE_fromRGB = (a: RGB, b: RGB) => {
const x1: LAB = convert.rgb.lab.raw(a) // Use .raw() to avoid rounding!
const x2: LAB = convert.rgb.lab.raw(b)
return getDeltaE_CIEDE2000(x1, x2)
}
const a: RGB = [255, 192, 63]
const b: RGB = [192, 63, 255]
getDeltaE_fromRGB(a, b) // 70.5183071276013
The output of the getDeltaE functions are properly tested using Vitest.
Tests may be run with one of the following commands:
npm test
# or
pnpm test
# or
bun run test
FAQs
CIE color difference algorithms in JavaScript/TypeScript.
We found that deltae-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.