Math & data behind color spaces and color conversions.
Installations
npm install color-space
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
23.5.0
NPM Version
10.9.2
Score
99.9
Supply Chain
99.6
Quality
94.4
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Languages
JavaScript (98.36%)
TypeScript (1.43%)
HTML (0.21%)
Developer
Download Statistics
Total Downloads
59,144,455
Last Day
72,200
Last Week
332,130
Last Month
1,400,366
Last Year
18,555,994
GitHub Statistics
328 Stars
372 Commits
26 Forks
12 Watching
3 Branches
21 Contributors
Bundle Size
28.16 kB
Minified
10.33 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.3.1
Package Id
color-space@2.3.1
Unpacked Size
192.60 kB
Size
56.37 kB
File Count
91
NPM Version
10.9.2
Node Version
23.5.0
Publised On
02 Feb 2025
Total Downloads
Cumulative downloads
Total Downloads
59,144,455
Last day
-4.5%
72,200
Compared to previous day
Last week
-11.2%
332,130
Compared to previous week
Last month
4.2%
1,400,366
Compared to previous month
Last year
36.1%
18,555,994
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
Color-space
![size](https://img.shields.io/bundlephobia/minzip/color-space/latest)
![](https://raw.githubusercontent.com/colorjs/color-space/gh-pages/logo.png)
Open collection of color spaces.
Demo.
Usage
1import space from 'color-space'; 2 3//convert lab to lch 4var result = space.lab.lch([80,50,60]);
Spaces can be imported separately:
1import rgb from 'color-space/rgb.js'; 2import hsl from 'color-space/hsl.js'; 3 4//convert rgb to hsl 5rgb.hsl([200, 230, 100]);
API
1<fromSpace>.<toSpace>(array); 2<space>.name //space name 3<space>.channel //channel names 4<space>.min //channel minimums 5<space>.max //channel maximums
Spaces
- RGB — sRGB
- LRGB – linear light sRGB
- HSL — cylindrical-coordinates sRGB
- HSV, HSB
- HWB
- HSI — used for computer vision due to better separation of shapes in an image, comparing to HSL/HSB.
- CMYK
- CMY
- XYZ
- XYY (YXY)
- LAB
- LCHab
- LUV
- LCHuv
- HSLuv
- HPLuv
- LABH
- YUV
- YIQ
- YCgCo
- YDbDr
- YPbPr
- YCbCr
- YcCbcCrc
- JPEG
- XvYCC
- UCS
- UVW
- OKLAB
- Munsell
- NCS
- PMS
- RAL
- TSL – color space designed for face detection purpose.
- RG
- RGK
- Coloroid — color space for architects and visual constructors, Hungarian Standard MSZ 7300 since 2000.
- OSA-UCS — accurately reprsenting uniform color differences, developed by the Optical Society of America’s Committee on Uniform Color Scales.
- HKS
- LMS — represents sensitivity of the human eye to Long, Medium and Short wavelengths.
- Cubehelix — colormaps for data visualization.
- Gray
- CIECAM02
- US Federal Standard 595
- Toyo
- PhotoYCC
- HCG
- HCL
- HSP
- HCY
- YES — computationally effective color space for face recognition.
- British Standard Colour
- RG chromacity
- CIE DSH
- HSM
Purpose
A complete collection of color spaces with minimal consistent and clean API, verified formulas and cases. While alternatives focus on digital color spaces, this project takes broader perspective, including historical / multidisciplinary spaces. A side effect is verifying and correcting papers.
Credits
Thanks to all who contribute to color science – researchers, scientists, color theorists, specifiers, implementors, developers, and users.
Similar
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
12 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: The Unlicense: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/colorjs/color-space/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/colorjs/color-space/test.yml/master?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
Found 2/21 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
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
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Score
4.6
/10
Last Scanned on 2025-01-27
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