colorgrad-rs
Rust color scales library for charts, maps, data-visualization and creative coding.
Index
Usage
Add colorgrad to your Cargo.toml
[dependencies]
colorgrad = "0.1.0"
Custom Gradient
Basic
let g = new.build.unwrap;

Custom Colors
let g = new
.colors
.build
.unwrap;

Using Web Color Format
.html_colors() method accepts named colors, hexadecimal (#rgb, #rgba, #rrggbb, #rrggbbaa), rgb(), rgba(), hsl(), hsla(), hwb(), and hsv().
let g = new
.html_colors
.build
.unwrap;

let g = new
.html_colors
.build
.unwrap;

let g = new
.html_colors
.build
.unwrap;

Domain & Color Position
let g = new
.html_colors
.build
.unwrap;
assert_eq!;

let g = new
.html_colors
.domain
.build
.unwrap;
assert_eq!;

let g = new
.html_colors
.domain
.build
.unwrap;
assert_eq!;

let g = new
.html_colors
.domain
.build
.unwrap;
assert_eq!;

let g = new
.html_colors
.domain
.build
.unwrap;
assert_eq!;

Blending Mode
let g = new
.html_colors
.mode
.build
.unwrap;

let g = new
.html_colors
.mode
.build
.unwrap;

Preset Gradients
All preset gradients are in the domain 0..1.
Diverging
colorgrad::brbg()

colorgrad::prgn()

colorgrad::piyg()

colorgrad::puor()

colorgrad::rdbu()

colorgrad::rdgy()

colorgrad::rdylbu()

colorgrad::rdylgn()

colorgrad::spectral()

Sequential (Single Hue)
colorgrad::blues()

colorgrad::greens()

colorgrad::greys()

colorgrad::oranges()

colorgrad::purples()

colorgrad::reds()

Sequential (Multi-Hue)
colorgrad::turbo()

colorgrad::viridis()

colorgrad::inferno()

colorgrad::magma()

colorgrad::plasma()

colorgrad::cividis()

colorgrad::warm()

colorgrad::cool()

colorgrad::cubehelix_default()

Cyclical
colorgrad::rainbow()

colorgrad::sinebow()

Hard-Edged Gradient
let g1 = new
.html_colors
.build
.unwrap;
let g2 = g1.sharp;


let g = spectral.sharp;

Examples
Gradient Image
extern crate colorgrad;
extern crate image;

Colored Noise
extern crate colorgrad;
extern crate image;
extern crate noise;
use NoiseFn;
// Map value which is in range [a, b] to range [c, d]
