Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
gradient-gauss
Advanced tools
A library to generate a color in a gradient using a Gaussian function. The gradient gauss library is provided a range of numbers and will then calculate the respective color for a given number with the range.
Simple demo showing the changes the gradient when certain parameters are tweaked.
Download the package via NPM
npm install gradient-gauss
import GradientGauss from 'gradient-gauss
or
const GradientGauss = require('gradient-gauss');
let gradient = new GradientGauss(1, 100); // Instantiate gradient gauss with a range of 1-100
let color = gradient.getColor(50); // Get the color for value 50
Options can be provided to GradientGauss to modify the behavior when calculating the colors. The following are the values that can be provided via the options:
min
: the minimum value of your rangemax
: the maximum value of your rangeoutputFormat
: the result format of the color. Options are either 'rgba'
(for an rgba string) or 'array'
(for an array in the format [r,g,b,a])redCenterFactor
: the location of the red bell curve center within the range providedblueCenterFactor
: the location of the blue bell curve center withiin the range providedgreenCenterFactor
: the location of the green bell curve center withini the range providedrangeDivisor
: the number by which the number range will be divided the color bell curve widthsNote: The min and max options are not be used during instantiation. Check the documentation for more information on the options and default values.
options = {
outputFormat: 'array',
rangeDivisor: 4
};
let gradient = new GradientGauss(1, 100, options);
Options can also be provided to the getColors
function as one-time overrides. For permanent changes to the values, provide those options during instantiation.
options = {
max: 50,
};
new GradientGauss(1, 100).getColor(25, options);
Refer to the documentation for more information.
Basic documentation
More to come.
Licensed under the MIT license.
FAQs
Library to generate colors using a smooth gauss function
The npm package gradient-gauss receives a total of 2 weekly downloads. As such, gradient-gauss popularity was classified as not popular.
We found that gradient-gauss demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.