JavaScript Library To Generate Linear Gradient Color Stops – gradStop.js

Category: Color , Javascript , Recommended | June 1, 2016
Author: Siddharth11
Views Total: 858
Official Page: Go to website
Last Update: June 1, 2016
License: MIT

Preview:

JavaScript Library To Generate Linear Gradient Color Stops – gradStop.js

Description:

gradStop.js is a lightweight JavaScript library used to generate linear, equidistant color gradients with a specific number of stops.

Basic usage:

First you need to include the gradStop.js library on the webpage.

<script src="dist/gradstop.js"></script>

Create a new gradStop object with options.

var gradient = gradStop({
    stops: 10,
    inputFormat: 'hex',
    colorArray: ['#343838', '#00DFFC', '#f6ff00']
});

Output the gradient colors.

console.log(gradient);

Default options.

// input color options: hex, rgb or hsl
inputFormat: 'hex',

// number of equidistant color stops (cannot be less than colorArray.length)
stops: 5,

// input color array (currently supports only 2)
colorArray: ['#fff', '#000']