Skip to content

color.map.coolwarm

Summary

color.map.coolwarm maps a scalar range from blue through a light neutral midpoint to red. To show signed deviations, center the input value range on zero so that zero samples the midpoint at 0.5.

Syntax

coolwarm(): Colormap
const map = WasmGPU.color.map.coolwarm();

Returns

Colormap - Shared 256-texel, linearly filtered map with CPU and GPU sampling. Equivalent to WasmGPU.color.map.builtin("coolwarm").

Example

import WasmGPU from "@zushah/wasmgpu";

const map = WasmGPU.color.map.coolwarm();
const deviation = -3; // Display range [-10, 10]
const rgba = map.sampleCPU((deviation + 10) / 20);

See Also