dist/color-map-rainbow.es2015.js
/**
     * Create colors with specified color map.
     */
Create colors with specified color map.
Create colors with specified color map .
function createColorsFromMap(colormap, shades, alpha) {
        if (shades < colormap.length) {
            throw new Error(`Requires at least ${colormap.length} shades.`);
        }
        const result = [];
        const steps = [];
        for (let i = 0; i < colormap.length; i++) {
            steps.push(Math.round(colormap[i].index * shades));
        }
        for (let i = 0; i < colormap.length - 1; i++) {
            const n = steps[i + 1] - steps[i];
            const from = colormap[i].rgb;
            const to = colormap[i + 1].rgb;
            result.push(...createColors(from, to, n, alpha));
        }
        return result;
    }
function createColorsFromMap ( colormap , shades , alpha ) { if ( shades < colormap . length ) { throw new Error ( ` ${ colormap . length } ` ) ; } const result = [ ] ; const steps = [ ] ; for ( let i = 0 ; i < colormap . length ; i ++ ) { steps . push ( Math . round ( colormap [ i ] . index * shades ) ) ; } for ( let i = 0 ; i < colormap . length - 1 ; i ++ ) { const n = steps [ i + 1 ] - steps [ i ] ; const from = colormap [ i ] . rgb ; const to = colormap [ i + 1 ] . rgb ; result . push ( ... createColors ( from , to , n , alpha ) ) ; } return result ; }
Create colors with specified color map.
Create colors with specified color map .