Generating Color Palettes with Pure JavaScript – jPalette

Category: Color , Javascript | September 16, 2015
Author: jsrdescamps
Views Total: 820
Official Page: Go to website
Last Update: September 16, 2015
License: MIT

Preview:

Generating Color Palettes with Pure JavaScript – jPalette

Description:

jPalette is a lightweight JavaScript library for generating a color palettes with custom steps and color schemes.

Basic usage:

Include the necessary JavaScript file jpalette.js on the web page.

<script src="jpalette.js"></script>

Generate a color palette from manual colors.

var colorPalette = new jPalette.ColorMap(100, [
    new jPalette.Color(255, 0, 0, 255),
    new jPalette.Color(255, 255, 0, 255),
    new jPalette.Color(0, 255, 255, 255),
    new jPalette.Color(0, 0, 255, 255),
  ]);

Generate a predefined color palette.

var colorMap1 = jPalette.ColorMap.get('whitetoblack')(20);
var colorMap2 = jPalette.ColorMap.get('rgb')(50);
var colorMap3 = jPalette.ColorMap.get('fire')(1000);
var colorMap4 = jPalette.ColorMap.get('sky')(1000);
var colorMap5 = jPalette.ColorMap.get('night')(1000);