Installations
npm install simple-color-converter
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 0.8
Node Version
12.18.3
NPM Version
6.14.6
Score
76.2
Supply Chain
98.4
Quality
76
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
draganradu
Download Statistics
Total Downloads
127,106
Last Day
137
Last Week
661
Last Month
4,112
Last Year
41,900
GitHub Statistics
20 Stars
58 Commits
2 Forks
2 Watching
19 Branches
1 Contributors
Bundle Size
164.01 kB
Minified
58.29 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.1.13
Package Id
simple-color-converter@2.1.13
Unpacked Size
54.94 kB
Size
14.49 kB
File Count
18
NPM Version
6.14.6
Node Version
12.18.3
Total Downloads
Cumulative downloads
Total Downloads
127,106
Last day
-37.4%
137
Compared to previous day
Last week
-24.9%
661
Compared to previous week
Last month
20%
4,112
Compared to previous month
Last year
63.4%
41,900
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Dev Dependencies
4
Simple color converter for (almost) Any Color
It covers most colors formats from Pantone, Ral, Hex 3/4/6/8, HTML, sRgb, CMYK, etc for converting from -> and -< to. It's designed with simplicity in mind. you can pass data and specify the format or just let is guess what color you are trying to pass as string.
Install
$ npm install simple-color-converter
Usage
1const simpleColorConverter = require('simple-color-converter'); 2 3var color = new simpleColorConverter({ 4 ral: { ral: 3009 }, 5 to: 'cmyk' 6}) 7 8console.log(color) // { c: 0, m: 53, y: 60, k: 60 }
Supported colors
Expected input value list [here].
Expected output value list [here].
color system | object | array | string |
---|---|---|---|
cmyk | {c: 39, m: 0, y: 39, k: 7} | [39, 0, 39.7] | 'cmyk 39 0 39 7' |
grayscale | '78' | ||
hex3 | '#9E9' | ||
hex4 | '#9E9F' | ||
hex6 | '#90EE90' | ||
hex8 | '#90EE90FF' | ||
html | 'Light Green' | ||
hsl | { h: 120, s: 73.4, l: 74.9 } | [120, 73.4, 74.9] | 'hsl 120 73.4 74.9' |
hsv | { h: 120, s: 39.4, l: 93.3 } | [120, 39.4, 93.3] | 'hsl 120 39.4 93.3' |
lab | {l: 86.5, a: -46.3, b: 36.9} | [86.5, -46.3, 36.9] | 'lab 86.5 -46.3 36.9' |
pantone | {name: '358C'} | 'pantone 358C' | |
ral | { ral : 6019 } | 'ral 6019' | |
rgb | { r: 144, g: 238, b: 144 } | [144, 238, 144] | 'rgb 144 238 144' |
rgba | { r: 144, g: 238, b: 144, a: 1 } | [144, 238, 144, 1] | 'rgba 144 238 144 1' |
rgb decimal | 'rgb decimal 6812065' | ||
w | { r: 144, g: 238, b: 144, a: 1 } | [144, 238, 144, 1] | 'w 544' |
xyz | { x: 44, y: 69, z: 45 } | [44, 69, 45] | 'xyz 44 69 45' |
yuv | { y: 180, u: 113.2, v: 73.5 } | [ 180, 113.2, 73.5 ] | 'yuv 180 113.2 73.5' |
From
Any of the colors mentioned above. You can specify the color and it will be faster of just use the built in color detector.
1 2// faster 3var fasterColor = new simpleColorConverter({ 4 rgb: {r: 10, g: 200, b: 50}, 5 to: 'cmyk' 6}) 7 8// slower but more convenient 9 10var slowerColor = new simpleColorConverter({ 11 color: 'rgb 10 200 50', 12 to: 'cmyk' 13}) 14
Extra From colors | note |
---|---|
color | Autoidentify color |
hex | Autoidentify hex color |
android | hex8 |
Flags
flags are the arguments used for special modifiers. The most useful one is rendering grayscale color, but there is a debugger and a hexref flag created if you need to convert a color but also output a close hex similar color(in case of online color convertors).
1const simpleColorConverter = require('simple-color-converter'); 2 3var color = simpleColorConverter({ 4 hex3: '#228', 5 to: 'cmyk', 6 grayscale: true 7}) 8 9console.log(color) // { c: 0, m: 0, y: 0, k: 87 }
flag | output | data type | default | note |
---|---|---|---|---|
grayscale | grayscale value in the from format | boolean | false | |
hexref | Reference value in hex format | boolean | false | For Hex it equels Hex6 |
debug | this prevents the object cleanup | boolean | false |
Future
I am working on version 3 or this package and the new version will be a modern setter and getter based color convertor. A much modern way of approaching this problem.
Contribute
If there are any features you would like to support, or want to add it directly please send us a pull request. I`m more then happy.
If you have any suggestions or you spotted an aberrant behavior or bugs, don't hesitate to send me an email.
License
Copyright © 2019, Radu Dragan. Licensed under the MIT License.
Thank you
I`m Radu, Thank you for using my color convertor, I hope it is useful for you. I genuinely excited to build this kind of solutions.
No vulnerabilities found.
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: MIT License: LICENSE:0
Reason
Found 0/30 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
Reason
Project has not signed or included provenance with any releases.
Details
- Warn: release artifact simple-color-convertor-pantone-ral not signed: https://api.github.com/repos/draganradu/simple-color-convertor-pantone-ral/releases/21248172
- Warn: release artifact simple-color-convertor-pantone-ral does not have provenance: https://api.github.com/repos/draganradu/simple-color-convertor-pantone-ral/releases/21248172
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
33 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.5
/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 MoreOther packages similar to simple-color-converter
ts-color-converter
TsColorConverter is a TypeScript library for converting between various color formats (HEX, RGB, RGBA, HSL, HSLA, HSB, HSBA). It provides a simple and consistent API for color manipulation and conversion.
color-converter-qwynbleid
Simple javascript color converter
@apiverve/colorconverter
Color Converter is a simple tool for converting color formats. It returns the color converted to the specified format.
got-color
Simple HEX --> RGB Converter