const colorMapId = 'HelloWorld'; const colormap = cornerstone.colors.getColormap(colorMapId); const distinctColors = [ [255, 255, 255, 255], [60, 180, 175, 255], [255, 225, 25, 255], [0, 130, 200, 255], ]; colormap.setNumberOfColors(distinctColors.length); for (let i = 0; i < distinctColors.length; i++) { colormap.setColor(i, distinctColors[i]); } cornerstoneTools.store.modules.brush.state.colorMapId = colorMapId;