turbo-colormap

A TypeScript library for working with Turbo, an improved rainbow colormap for visual­ization. Turbo is often used for depth maps. This library includes the ability to “uncolormap” Turbo, converting values back to normalized floats or grayscale intensities. In addition to the library, you can also use this demo page to perform quick color and image conversions.

This library generates more faithful values than the d3 approx­imation of Turbo found in d3-scale-chromatic.

See the README on GitHub.

npm install turbo-colormap

color converter

Two-way conversion between grayscale intensity and Turbo.

normalized:
0.647058824
rgb:
rgb(165, 165, 165)
hex:
#a5a5a5
normalized:
0.647058824
rgb:
rgb(244, 196, 58)
hex:
#f4c43a

image converter

Some tools expect grayscale depth maps. Load images into the area below to convert between grayscale and Turbo images. Conversion is done client-side; all data stays in your browser.

tap or drag & drop Turbo image

tap or drag & drop grayscale image

This demo will consume a little CPU and needs to be enabled first.

nearest color

Snap arbitrary colors to the indexed Turbo palette. This can yield surprising results with much of the sRGB color space; it’s mostly useful for interpreting visual­izations exported with an approx­imation of Turbo or a lossy format like JPEG, where not every pixel will be in the Turbo lookup table.

The nearest color is determined by simple Euclidian distance using a k-d tree.