Function scale

Produces a stepped scale of colours.

Return result is an array of Color.js 'Colour' objects.

import { Colour } from 'ixfx/visual'
const steps = Colour.scale(['red','green'], 10);
for (const step of steps) {
// Get a 'hsla(...)' string representation of colour
// This can be used with the canvas, setting DOM properties etc.
const css = Colour.toString(step);
}

cssLinearGradient can produce a smooth gradient in CSS on the basis of the stepped colours.

  • Parameters

    Returns Color[]