
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.
image-to-gradient
Advanced tools
This project allows you to easily create CSS gradients from images. The step count is variable. Any angle is supported. Alpha channel is also processed.
There is one exported function with 3 parameters. You specify the path through the first parameter, you pass in the options in the second parameter and you pass in a callback function in the third parameter;
The example below creates a gradient from an image and generates a dummy html file with the background set to the gradient.
var imageToGradient = require('image-to-gradient');
var options = {
angle:10, // gradient angle in degrees
steps:64 // number of steps
}
imageToGradient('testimage.jpg', options, function(err, cssGradient){
if (err) throw err;
var html = `
<html>
<head>
<style>
html{
width:100%;
height:100%;
background:${cssGradient};
}
</style>
</head>
<body>
</body>
</html>`
var fs = require('fs');
fs.writeFile('output.html', html, (err) => {
if (err) throw err;
console.log('The file has been saved!');
});
});
Here is an example how to speed up initial load!
FAQs
Convert an image to a linear CSS gradient of any angle.
The npm package image-to-gradient receives a total of 0 weekly downloads. As such, image-to-gradient popularity was classified as not popular.
We found that image-to-gradient demonstrated a healthy version release cadence and project activity because the last version was released less than 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.