Gathering detailed insights and metrics for chartjs-color
Gathering detailed insights and metrics for chartjs-color
Gathering detailed insights and metrics for chartjs-color
Gathering detailed insights and metrics for chartjs-color
npm install chartjs-color
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
21 Stars
129 Commits
6 Forks
4 Watching
1 Branches
5 Contributors
Updated on 07 Feb 2023
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-1.7%
147,730
Compared to previous day
Last week
3.6%
786,951
Compared to previous week
Last month
4%
3,400,416
Compared to previous month
Last year
-18.7%
41,852,034
Compared to previous year
2
JavaScript library for color conversion and manipulation with support for CSS color strings.
1var color = Color("#7743CE"); 2 3color.alpha(0.5).lighten(0.5); 4 5console.log(color.hslString()); // "hsla(262, 59%, 81%, 0.5)"
1$ npm install color
1var Color = require("color")
1var color = Color("rgb(255, 255, 255)") 2var color = Color({r: 255, g: 255, b: 255}) 3var color = Color().rgb(255, 255, 255) 4var color = Color().rgb([255, 255, 255])
Pass any valid CSS color string into Color()
or a hash of values. Also load in color values with rgb()
, hsl()
, hsv()
, hwb()
, and cmyk()
.
1color.red(120)
Set the values for individual channels with alpha
, red
, green
, blue
, hue
, saturation
(hsl), saturationv
(hsv), lightness
, whiteness
, blackness
, cyan
, magenta
, yellow
, black
1color.rgb() // {r: 255, g: 255, b: 255}
Get a hash of the rgb values with rgb()
, similarly for hsl()
, hsv()
, and cmyk()
1color.rgbArray() // [255, 255, 255]
Get an array of the values with rgbArray()
, hslArray()
, hsvArray()
, and cmykArray()
.
1color.red() // 255
Get the value for an individual channel.
1color.hslString() // "hsl(320, 50%, 100%)"
Different CSS String formats for the color are on hexString
, rgbString
, percentString
, hslString
, hwbString
, and keyword
(undefined if it's not a keyword color). "rgba"
and "hsla"
are used if the current alpha value of the color isn't 1
.
1color.luminosity(); // 0.412
The WCAG luminosity of the color. 0 is black, 1 is white.
1color.contrast(Color("blue")) // 12
The WCAG contrast ratio to another color, from 1 (same color) to 21 (contrast b/w white and black).
1color.light(); // true 2color.dark(); // false
Get whether the color is "light" or "dark", useful for deciding text color.
1color.negate() // rgb(0, 100, 255) -> rgb(255, 155, 0) 2 3color.lighten(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%) 4color.darken(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%) 5 6color.saturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%) 7color.desaturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%) 8color.greyscale() // #5CBF54 -> #969696 9 10color.whiten(0.5) // hwb(100, 50%, 50%) -> hwb(100, 75%, 50%) 11color.blacken(0.5) // hwb(100, 50%, 50%) -> hwb(100, 50%, 75%) 12 13color.clearer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 0.4) 14color.opaquer(0.5) // rgba(10, 10, 10, 0.8) -> rgba(10, 10, 10, 1.0) 15 16color.rotate(180) // hsl(60, 20%, 20%) -> hsl(240, 20%, 20%) 17color.rotate(-90) // hsl(60, 20%, 20%) -> hsl(330, 20%, 20%) 18 19color.mix(Color("yellow")) // cyan -> rgb(128, 255, 128) 20color.mix(Color("yellow"), 0.3) // cyan -> rgb(77, 255, 179) 21 22// chaining 23color.green(100).greyscale().lighten(0.6)
You can can create a copy of an existing color object using clone()
:
1color.clone() // -> New color object
And more to come...
The API was inspired by color-js. Manipulation functions by CSS tools like Sass, LESS, and Stylus.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 4/24 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
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