
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
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
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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.