Gathering detailed insights and metrics for hex-rgb
Gathering detailed insights and metrics for hex-rgb
Gathering detailed insights and metrics for hex-rgb
Gathering detailed insights and metrics for hex-rgb
npm install hex-rgb
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.8
Supply Chain
94.4
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (91.44%)
TypeScript (8.56%)
Total Downloads
52,964,133
Last Day
21,058
Last Week
401,466
Last Month
1,807,568
Last Year
17,903,362
MIT License
131 Stars
24 Commits
23 Forks
5 Watchers
1 Branches
7 Contributors
Updated on Feb 19, 2025
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
hex-rgb@5.0.0
Size
2.52 kB
NPM Version
7.10.0
Node Version
16.0.0
Published on
May 03, 2021
Cumulative downloads
Total Downloads
Last Day
-13.7%
21,058
Compared to previous day
Last Week
-13.4%
401,466
Compared to previous week
Last Month
2%
1,807,568
Compared to previous month
Last Year
20.8%
17,903,362
Compared to previous year
Convert HEX color to RGBA
$ npm install hex-rgb
1import hexRgb from 'hex-rgb'; 2 3hexRgb('4183c4'); 4//=> {red: 65, green: 131, blue: 196, alpha: 1} 5 6hexRgb('#4183c4'); 7//=> {red: 65, green: 131, blue: 196, alpha: 1} 8 9hexRgb('#fff'); 10//=> {red: 255, green: 255, blue: 255, alpha: 1} 11 12hexRgb('#22222299'); 13//=> {red: 34, green: 34, blue: 34, alpha: 0.6} 14 15hexRgb('#0006'); 16//=> {red: 0, green: 0, blue: 0, alpha: 0.4} 17 18hexRgb('#cd2222cc'); 19//=> {red: 205, green: 34, blue: 34, alpha: 0.8} 20 21hexRgb('#cd2222cc', {format: 'array'}); 22//=> [205, 34, 34, 0.8] 23 24hexRgb('#cd2222cc', {format: 'css'}); 25//=> 'rgb(205 34 34 / 80%)' 26 27hexRgb('#000', {format: 'css'}); 28//=> 'rgb(0 0 0)' 29 30hexRgb('#22222299', {alpha: 1}); 31//=> {red: 34, green: 34, blue: 34, alpha: 1} 32 33hexRgb('#fff', {alpha: 0.5}); 34//=> {red: 255, green: 255, blue: 255, alpha: 0.5}
Type: string
The color in HEX format. Leading #
is optional.
Type: object
Type: string
Values: 'object' | 'array' | 'css'
Defaults: 'object'
The RGB output format.
Note that when using the css
format, the value of the alpha channel is rounded to two decimal places.
Type: number
Set the alpha of the color.
This overrides any existing alpha component in the Hex color string. For example, the 99
in #22222299
.
The number must be in the range 0 to 1.
See rgb-hex for the inverse.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 7/24 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
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