Get started with chroma-js CDN

MIT licensed

Small library: Chroma.js manipulates colors in browsers, Node.js.

Tags:
  • color

Stable version

Copied!

How to start using chroma-js CDN


// Include Chroma.js library
const Chroma = require('chroma-js/dist/chroma.min.js');

// Define the base color
const baseColor = new Chroma('blue');

// Get the hex code of the base color
const baseColorHex = baseColor.hex();
console.log('Base color hex:', baseColorHex);

// Define the amount to shift the color
const shiftAmount = 50;

// Create a new color shifted by the specified amount
const shiftedColor = baseColor.shift(shiftAmount);

// Get the hex code of the new color
const shiftedColorHex = shiftedColor.hex();
console.log('Shifted color hex:', shiftedColorHex);
Copied!

All versions