small and simple js library to easily create a color gradient for as many colors as wanted
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



This small javascript library calculates a gradient of multiple colors. The result and whole gradient can be accessed via percentage. The gradient will only be calculated once to save execution time.

Basic Usage

1.) Include library:

<script type="text/javascript" src="color.gradient.min.js"></script>

2.) Initialize by pass a color array for the gradient and read the values by percentage selector:

var gradient = new ColorGradient(["#f00", "#0f0", "#00f"]);
var color = gradient.getHexColorAtPercentage([0...100]);

Take a look at the example for more details.

Bugs / Feature request

Please report bugs and feel free to ask for new features directly on GitHub.


js.colorGradient is dual-licensed under MIT and GPL-2.0 license.