Installations
npm install d3-color-difference
Releases
Unable to fetch releases
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
9.11.1
NPM Version
5.6.0
Statistics
29 Stars
19 Commits
7 Forks
3 Watching
2 Branches
9 Contributors
Updated on 08 Jun 2024
Bundle Size
13.47 kB
Minified
5.06 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
63,495
Last day
14.6%
47
Compared to previous day
Last week
19.7%
450
Compared to previous week
Last month
-27.1%
2,189
Compared to previous month
Last year
-6.6%
19,521
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
d3-color-difference
See this Observable notebook for a demonstration.
Installing
1$ npm install d3-color-difference
API Reference
Euclidean Distances
# d3.differenceEuclideanRGB(a, b) <>
Computes the Euclidean distance between the colors a and b in the RGB color space.
# d3.differenceEuclideanLab(a, b) <>
Computes the Euclidean distance between the colors a and b in the Lab color space.
# d3.differenceEuclideanHcl(a, b) <>
Computes the Euclidean distance between the colors a and b in the HCL color space.
# d3.differenceEuclideanHsl(a, b) <>
Computes the Euclidean distance between the colors a and b in the HSL color space.
# d3.differenceEuclideanCubehelix(a, b) <>
Computes the Euclidean distance between the colors a and b in the Cubehelix color space.
CIE Delta-E
Computes the CIE76 ΔE*ab color difference between the colors a and b. The computation is done in the Lab color space and it is analogous to differenceEuclideanLab.
Computes the CIE94 ΔE*94 color difference between the colors a and b. The computation is done in the Lab color space, with the default weights kL = 1, K1 = 0.045, and K2 = 0.015.
# d3.differenceCie94Weighted(kL, K1, K2) <>
Returns a CIE94 difference function with custom weighting parameters.
# d3.differenceCiede2000(a, b) <>
Computes the CIEDE2000 ΔE*00 color difference between the colors a and b as implemented by G. Sharma. The computation is done in the Lab color space, with the default weights kL = kC = kH = 1.
# d3.differenceCiede2000Weighted(kL, kC, kH) <>
Returns a CIEDE2000 difference function with custom weighting parameters.
Computes the CMC l:c (1984) ΔE*CMC color difference between the colors a and b. The computation is done in the Lab color space with the default weights l = c = 1.
Note: ΔE*CMC is not considered a metric since it's not symmetrical, i.e. the distance from a to b is not always equal to the distance from b to a.
# d3.differenceCmcWeighted(l, c) <>
Returns a CMC l:c (1984) difference function with custom weighting parameters.
# d3.differenceDin99o(a, b) <>
Computes the DIN99o ΔE*99o color difference between the colors a and b. The computation is done in the DIN99o color space with the default weights kCH = kE = 1.
# d3.differenceDin99oWeighted(kCH, kE) <>
Returns a DIN99o difference function with custom weighting parameters.
Opacity
# d3.differenceWithOpacity(differenceFunction, a, b) <>
The difference functions don't take the colors' alpha channel into account when computing distances. This method allows you to factor the colors' opacities into the distance.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: BSD 3-Clause "New" or "Revised" License: LICENSE:0
Reason
Found 0/19 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Score
3.5
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More