Crates.io | colorous |
lib.rs | colorous |
version | |
source | src |
created_at | 2020-04-27 15:20:36.825756 |
updated_at | 2024-11-30 12:05:57.166988 |
description | Professional color schemes ported from d3-scale-chromatic |
homepage | |
repository | https://github.com/dtolnay/colorous |
max_upload_size | |
id | 234686 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.