
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
gradient-base
Advanced tools
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 9 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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.