in neuron-viewer/src/types.ts [52:62]
export function getInterpolatedColor(colors: Color[], boundaries: number[], value: number) {
const index = boundaries.findIndex((boundary) => boundary >= value)
const colorIndex = Math.max(0, index - 1)
const color_left = colors[colorIndex]
const color_right = colors[colorIndex + 1]
const boundary_left = boundaries[colorIndex]
const boundary_right = boundaries[colorIndex + 1]
const ratio = (value - boundary_left) / (boundary_right - boundary_left)
const color = interpolateColor(color_left, color_right, ratio)
return color
}