Expand description
§Prismatica – Scientific Colormaps for Rust
308 scientific colormaps + 70 discrete palettes from 10 collections: matplotlib, Crameri, CET, CMOcean, ColorBrewer, CMasher, NCAR, CartoColors, Moreland, and d3.
use prismatica::crameri::BATLOW;
let color = BATLOW.eval(0.5);
println!("RGB: ({}, {}, {})", color.r, color.g, color.b);§Feature Flags
| Feature | Colormaps | Description |
|---|---|---|
core (default) | 48 | matplotlib (8) + Crameri (40) |
cet | +59 | Peter Kovesi’s perceptually uniform maps |
cmocean | +22 | Oceanographic colormaps |
colorbrewer | +35 (+35 palettes) | Cynthia Brewer’s cartographic palettes |
cmasher | +53 | Astrophysics colormaps |
ncar | +44 | NCAR NCL geoscience maps |
cartocolors | +34 (+34 palettes) | CARTO cartographic maps |
moreland | +6 | Cool-warm, black body, Kindlmann |
d3 | +7 (+1 palette) | Turbo, Rainbow, Sinebow, Cubehelix, Tableau10 |
all | 308 (+70 palettes) | Everything |
§Framework Integrations
All integrations provide bidirectional conversion via From/Into.
Enum-based types (ratatui, crossterm, colored, cursive, comfy-table) use
TryFrom for the reverse direction.
| Feature | Framework | Type |
|---|---|---|
egui-integration | egui | Color32 |
plotters-integration | plotters | RGBColor |
image-integration | image | Rgb<u8> |
palette-integration | palette | Srgb<u8> |
bevy-color-integration | bevy_color | Srgba |
iced-integration | iced | iced::Color |
macroquad-integration | macroquad | macroquad::Color |
tiny-skia-integration | tiny-skia | tiny_skia::Color |
wgpu-integration | wgpu-types | wgpu_types::Color |
slint-integration | slint | slint::Color |
ratatui-integration | ratatui | ratatui::Color |
crossterm-integration | crossterm | crossterm::Color |
colored-integration | colored | colored::Color |
owo-colors-integration | owo-colors | owo_colors::Rgb |
termion-integration | termion | termion::color::Rgb |
cursive-integration | cursive | cursive::Color |
comfy-table-integration | comfy-table | comfy_table::Color |
syntect-integration | syntect | syntect::Color |
serde-support | serde | Serialize/Deserialize |
all-integrations | all of the above (except termion, which is Unix-only) |
Note: palette-integration, bevy-color-integration, tiny-skia-integration,
and slint-integration pull in std via their upstream dependencies and are not
compatible with no_std targets.
§Choosing a Colormap
- Sequential data (temperature, elevation, concentration):
batlow,viridis,oslo,thermal - Diverging data (anomalies, residuals):
berlin,vik,balance,smooth-cool-warm - Cyclic data (phase, direction, time-of-day):
romaO,phase,twilight - Categorical data (labels, classes):
SET2,DARK2,PAIRED,Tableau10
§Minimum Supported Rust Version
Prismatica requires Rust 1.85 or later (edition 2024).
Modules§
- cartocolors
cartocolors - CartoColors cartographic colormaps – 34 colormaps + 34 discrete palettes.
- cet
cet - CET Perceptually Uniform Colour Maps – 59 colormaps.
- cmasher
cmasher - CMasher colormaps for astrophysics visualization – 53 colormaps.
- cmocean
cmocean - CMOcean oceanographic colormaps (thermal, haline, solar, ice, deep, and 17 more).
- colorbrewer
colorbrewer - ColorBrewer palettes (sequential, diverging, and qualitative cartographic schemes).
- crameri
crameri - Crameri Scientific Colour Maps – 40 colormaps.
- d3
d3 - d3-scale-chromatic colormaps – 7 colormaps + 1 discrete palette (Tableau10).
- matplotlib
matplotlib - Matplotlib colormaps (viridis, inferno, magma, plasma, cividis, twilight, mako, rocket).
- moreland
moreland - Moreland colormaps (cool-warm, black body, Kindlmann, and variants).
- ncar
ncar - NCAR NCL geoscience colormaps – 44 colormaps.
- prelude
- Convenience re-exports for common prismatica types.
Structs§
- Color
- An sRGB color with 8-bit channels.
- Colormap
- A continuous colormap backed by a precomputed lookup table.
- Colormap
Meta - Metadata about a colormap’s scientific properties.
- Conversion
Error - Error returned when a framework color cannot be converted to
Color. - Discrete
Palette - A discrete palette of distinct colors for categorical data.
- Parse
Color Error - Error returned when parsing a
Colorfrom a string fails. - Reversed
Colormap - A reversed view of a colormap. Zero allocation.
Enums§
- Colormap
Kind - The type/class of a colormap, following standard scientific nomenclature.
Traits§
- Into
Framework Color - Trait for converting a prismatica
Colorto a framework-specific color type.
Functions§
- all_
colormaps allocorstd - Returns all colormaps enabled by the current feature flags.
- all_
discrete_ palettes allocorstd - Returns all discrete palettes enabled by the current feature flags.
- filter_
by_ collection allocorstd - Return all colormaps from a given collection.
- filter_
by_ kind allocorstd - Return all colormaps of a given kind.
- find_
by_ name - Look up a colormap by its canonical name (case-sensitive).
- find_
palette_ by_ name - Look up a discrete palette by its canonical name (case-sensitive).