All files / packages/core/src/utilities colormap.ts

25% Statements 1/4
100% Branches 0/0
0% Functions 0/3
25% Lines 1/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33    1x                                                            
import { ColormapRegistration } from '../types';
 
const _colormaps = new Map();
 
/**
 * Register a colormap
 * @param name - name of the colormap
 * @param colormap - colormap object
 */
function registerColormap(colormap: ColormapRegistration) {
  _colormaps.set(colormap.Name, colormap);
}
 
/**
 * Get a colormap by name
 * @param name - name of the colormap
 * @returns colormap object
 */
function getColormap(name) {
  return _colormaps.get(name);
}
 
/**
 * Get all registered colormap names
 * @returns array of colormap names
 *
 */
function getColormapNames() {
  return Array.from(_colormaps.keys());
}
 
export { getColormap, getColormapNames, registerColormap };