Crates.io | colorous |
lib.rs | colorous |
version | 1.0.14 |
source | src |
created_at | 2020-04-27 15:20:36.825756 |
updated_at | 2024-05-06 22:47:26.872146 |
description | Professional color schemes ported from d3-scale-chromatic |
homepage | |
repository | https://github.com/dtolnay/colorous |
max_upload_size | |
id | 234686 |
size | 131,928 |
This crate provides a collection of sequential, diverging and categorical color
schemes ported from d3-scale-chromatic. Each color scheme may be sampled using
either a rational index i/n
or a continuous float 0 ≤ t ≤ 1
.
pub fn eval_rational(&self, i: usize, n: usize) -> Color
pub fn eval_continuous(&self, t: f64) -> Color
let gradient = colorous::VIRIDIS;
for i in 0..100 {
println!("{:x}", gradient.eval_rational(i, 100));
}
# colorous::TURBO
The “turbo” color scheme by Anton Mikhailov.
# colorous::VIRIDIS
The “viridis” perceptually-uniform color scheme designed by van der Walt, Smith and Firing for matplotlib.
# colorous::INFERNO
The “inferno” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib.
# colorous::MAGMA
The “magma” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib.
# colorous::PLASMA
The “plasma” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib.
# colorous::CIVIDIS
The “cividis” color vision deficiency-optimized color scheme designed by Nuñez, Anderton, and Renslow.
# colorous::WARM
A 180° rotation of Niccoli’s perceptual rainbow.
# colorous::COOL
# colorous::CUBEHELIX
# colorous::BLUE_GREEN
# colorous::BLUE_PURPLE
# colorous::GREEN_BLUE
# colorous::ORANGE_RED
# colorous::PURPLE_BLUE_GREEN
# colorous::PURPLE_BLUE
# colorous::PURPLE_RED
# colorous::RED_PURPLE
# colorous::YELLOW_GREEN_BLUE
# colorous::YELLOW_GREEN
# colorous::YELLOW_ORANGE_BROWN
# colorous::YELLOW_ORANGE_RED
# colorous::BLUES
# colorous::GREENS
# colorous::GREYS
# colorous::ORANGES
# colorous::PURPLES
# colorous::REDS
# colorous::BROWN_GREEN
# colorous::PURPLE_GREEN
# colorous::PINK_GREEN
# colorous::PURPLE_ORANGE
# colorous::RED_BLUE
# colorous::RED_GREY
# colorous::RED_YELLOW_BLUE
# colorous::RED_YELLOW_GREEN
# colorous::SPECTRAL
# colorous::RAINBOW
The cyclical less-angry rainbow color scheme.
# colorous::SINEBOW
The “sinebow” color scheme by Jim Bumgardner and Charlie Loyd.
Categorical color schemes are exposed simply as an array [Color; N]
.
# colorous::CATEGORY10
# colorous::ACCENT
# colorous::DARK2
# colorous::PAIRED
# colorous::PASTEL1
# colorous::PASTEL2
# colorous::SET1
# colorous::SET2
# colorous::SET3
# colorous::TABLEAU10
Ten categorical colors authored by Tableau as part of Tableau 10.
Licensed under the Apache License, Version 2.0.