color-string
npmv2.1.4TypeScriptParser and generator for CSS color strings
Safe to adopt
Yes — color-string scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 298 days ago. 6 releases in the last 2 years.
- ?Adoption: grade ?, Not reported by this registry.
No download data reported for this package yet.
- BMaintenance: grade B, Good.
Last published 298 days ago. 6 releases in the last 2 years.
- AWeight: grade A, Excellent.
Pulls in 1 transitive package, about 17 KB installed.
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding color-string to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Licenses in the dependency tree
Every license you inherit by installing color-string, not just its own. Check this before a legal review, not after.
Compatibility
- Node.js
- node >=18
- Module format
- ESM only
- TypeScript
- Types included
- Install scripts
- None
Quick start
A usage example from the color-string README.
colorString.get('#FFF') // {model: 'rgb', value: [255, 255, 255, 1]}
colorString.get('#FFFA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
colorString.get('#FFFFFFAA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
colorString.get('hsl(360, 100%, 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
colorString.get('hsl(360 100% 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
colorString.get('hwb(60, 3%, 60%)') // {model: 'hwb', value: [60, 3, 60, 1]}
colorString.get.rgb('#FFF') // [255, 255, 255, 1]
colorString.get.rgb('blue') // [0, 0, 255, 1]
colorString.get.rgb('rgba(200, 60, 60, 0.3)') // [200, 60, 60, 0.3]
colorString.get.rgb('rgba(200 60 60 / 0.3)') // [200, 60, 60, 0.3]
colorString.get.rgb('rgba(200 60 60 / 30%)') // [200, 60, 60, 0.3]
colorString.get.rgb('rgb(200, 200, 200)') // [200, 200, 200, 1]
colorString.get.rgb('rgb(200 200 200)') // [200, 200, 200, 1]color-string vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| color-stringthis page | 0 | 1 | MIT | 9 months ago |
| color-convert | 299.6M | 1 | MIT | 1 day ago |
| color | 45.5M | 3 | MIT | 1 day ago |
| @csstools/css-color-parser | 0 | 2 | MIT | 1 day ago |
| rgb2hex | 0 | 1 | MIT | 1 day ago |
| color-name | 306.6M | 3 | MIT | 1 day ago |
Dependencies
Declared by color-string v2.1.4. Runtime dependencies are installed with the package; dev dependencies are not.
Runtime (1)
Dev (2)
Used by
Popular packages that depend on color-string.
Relationship graph
Dependencies (left) and dependents (right) of color-string.
Frequently installed together
Release history
6 releases in the last two years, typically about 8 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 2.1.4latest | 9 months ago | 11 KB | MIT |
| 2.1.3 | 9 months ago | 11 KB | MIT |
| 2.1.2 | 1 year ago | 11 KB | MIT |
| 2.1.0 | 1 year ago | 11 KB | MIT |
| 2.0.1 | 1 year ago | 10 KB | MIT |
| 2.0.0 | 1 year ago | 10 KB | MIT |
| 1.9.1 | 4 years ago | 9.9 KB | MIT |
| 1.9.0 | 4 years ago | 9.9 KB | MIT |
| 1.8.2 | 4 years ago | 9.8 KB | MIT |
| 1.8.1 | 4 years ago | 9.7 KB | MIT |
| 1.8.0 | 4 years ago | 9.7 KB | MIT |
| 1.7.4 | 4 years ago | 9.7 KB | MIT |
| 1.7.3 | 4 years ago | 9.7 KB | MIT |
| 1.7.2 | 4 years ago | 9.7 KB | MIT |
| 1.7.1 | 4 years ago | 9.6 KB | MIT |
Overview
color-string is an npm package that parser and generator for CSS color strings. It has 1 known dependents in the graph. The latest version is 2.1.4, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need parser and generator for CSS color strings and value a focused solution.
When not to use it
Consider an alternative if you need to or if a more actively-maintained option better fits your npm stack.
Pros
- Ships TypeScript type definitions.
- Clear open-source license (MIT).
- Lean dependency tree (3 direct dependencies).
Cons
- No significant drawbacks detected from available metadata.
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use color-string?
Yes — color-string scores well across adoption, maintenance, weight, supply chain, and licensing. No download data reported for this package yet. Last published 298 days ago. 6 releases in the last 2 years.
How do I install color-string?
Run `npm install color-string` to add color-string to your npm project.
How many dependencies does color-string have?
color-string declares 3 direct dependencies and pulls in 1 packages in total once its runtime tree is resolved totalling about 17 KB on disk.
What license is color-string released under?
color-string is distributed under the MIT license.
How popular is color-string?
npm does not publish download counts. Within PackageGraph's crawl, 1 known packages depend on color-string.
Is color-string still maintained?
The most recent release of color-string (v2.1.4) was published 9 months ago.
Does color-string run install scripts?
No. color-string does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.