// Magma colormap (perceptually uniform, dark = quiet, bright = loud), 9 anchors interpolated. const ANCHORS: [number, number, number][] = [ [0, 0, 4], [28, 16, 68], [79, 18, 123], [129, 37, 129], [181, 54, 122], [229, 80, 100], [251, 135, 97], [254, 194, 135], [252, 253, 191], ]; export function magma(t: number): [number, number, number] { const u = t * (ANCHORS.length - 1); const i = Math.min(ANCHORS.length - 2, Math.floor(u)); const f = u - i; const a = ANCHORS[i]; const b = ANCHORS[i + 1]; return [a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f, a[2] + (b[2] - a[2]) * f]; }