Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
gradient-base
Advanced tools
Readme
This module creates base gradient output for gradient.js modules.
gradient.js is a javascript module that takes your source colors array and configuration object, and returns a gradient suitable for your needs.
Base.get
function takes 2 parameters: the colors array and the configuration object.
const base = new Base()
const g = base.get(colors, options)
// [[0,222,31,0.4],[1.3265624999999999,199.890625,31.331640625,0.466328125], (...)]
Colors input should be an array of numbers in rgb or rgba format or array of css rgb(a) strings.
Options object stands for the basic settings of the gradient creation, mandatory for the chroma-js library. Its interface looks like below:
{
interpolation: 'linear' | 'bezier'
mode: 'none' | 'lch' | 'lab' | 'rgb' | 'hsv' | 'hsl' | 'hsi' | 'hcl'
samples: number
lightnessCorrection: boolean
}
The mode
entry is ommited when the interpolation
is set to bezier
.
Usefullness of setting the lightness correction to true
(combined with the bezier
interpolation) is very well described by Gregor Aisch here.
The samples
stand for the number of the output colors. The more you set, the nicer gradient you get (but with worse performance of course).
Alpha values will be not preserved in the output if the interpolation
will be set to the bezier
value.
FAQs
Base module of the gradient.js library
The npm package gradient-base receives a total of 4 weekly downloads. As such, gradient-base popularity was classified as not popular.
We found that gradient-base 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
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.