Module scarlet::colormap [] [src]

This module defines a generalized trait for a colormap—a mapping of the numbers between 0 and 1 to colors in a continuous way—and provides some common ones used in programs like MATLAB and in data visualization everywhere.

Structs

GradientColorMap

A gradient colormap: a continuous, evenly-spaced shift between two colors A and B such that 0 maps to A, 1 maps to B, and any number in between maps to a weighted mix of them in a given coordinate space. Uses the gradient functions in the ColorPoint trait to complete this. Out-of-range values are simply clamped to the correct range: calling this on negative numbers will return A, and calling this on numbers larger than 1 will return B.

ListedColorMap

A colormap that linearly interpolates between a given series of values in an equally-spaced progression. This is modeled off of the matplotlib Python library's ListedColormap, and is only used to provide reference implementations of the standard matplotlib colormaps. Clamps values outside of 0 to 1.

Enums

NormalizeMapping

A struct that describes different transformations of the numbers between 0 and 1 to themselves, used for controlling the linearity or nonlinearity of gradients.

Traits

ColorMap

A trait that models a colormap, a continuous mapping of the numbers between 0 and 1 to colors. Any color output format is supported, but it must be consistent.