colorbrewer-rs
Get a Vec of colors (described using rgb crate) from one of the famous ColorBrewer palette.
These color specifications and designs are developed by Cynthia Brewer (http://colorbrewer2.org/).
Usage
use ;
// Use an existing palette from the `Palette` Enum and the wanted number of colors:
let ramp_orange = get_color_ramp;
assert_eq!;
// Or match the name of one palette with the corresponding Enum variant
// using the 'parse' method of a string:
let blue_pal: Palette = "Blues".parse.unwrap;
let ramp = get_color_ramp;
// `None` is returned if the number is invalid:
let ramp = get_color_ramp;
assert_eq!;
License
Licensed under Apache License, Version 2.0.
Credits
- Shameless copy/paste/replace all/etc. of the the
colorbrewerJSObjectfrom https://github.com/saikocat/colorbrewer to transform it in nested rustmatch, wrapped in a function. rustfmtmostly did the rest of the job.