🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

tinygradient

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinygradient

Fast and small gradients manipulation, built on top of TinyColor

2.0.1
latest
Source
npm
Version published
Weekly downloads
1.6M
34.51%
Maintainers
1
Weekly downloads
 
Created

What is tinygradient?

The tinygradient npm package is a lightweight library for creating and manipulating gradients. It allows you to generate gradients with multiple colors, interpolate colors, and convert gradients to different formats.

What are tinygradient's main functionalities?

Creating a Gradient

This feature allows you to create a gradient by specifying an array of color stops. The example creates a gradient from red to green to blue.

const tinygradient = require('tinygradient');
const gradient = tinygradient(['#ff0000', '#00ff00', '#0000ff']);
console.log(gradient);

Getting Colors from a Gradient

This feature allows you to get an array of colors from the gradient. The example gets 10 colors from the gradient.

const tinygradient = require('tinygradient');
const gradient = tinygradient(['#ff0000', '#00ff00', '#0000ff']);
const colors = gradient.rgb(10);
console.log(colors);

Converting Gradient to CSS

This feature allows you to convert the gradient to a CSS gradient string. The example converts the gradient to a linear gradient going to the right.

const tinygradient = require('tinygradient');
const gradient = tinygradient(['#ff0000', '#00ff00', '#0000ff']);
const cssGradient = gradient.css('linear', 'to right');
console.log(cssGradient);

Other packages similar to tinygradient

Keywords

color

FAQs

Package last updated on 18 Feb 2025

Did you know?

Socket

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.

Install

Related posts