Expand description
§colorbrewer
Library providing colors from ColorBrewer.
Licensed under Apache License, Version 2.0.
Use one member of the Palette
Enum
and the requested number of colors
to get the corresponding color ramp with the get_color_ramp
function.
use colorbrewer::*;
let ramp_orange = get_color_ramp(Palette::Oranges, 3);
assert_eq!(Some(vec![rgb::RGB { r: 254, g: 230, b: 206}, rgb::RGB { r: 253, g: 174, b: 107}, rgb::RGB { r: 230, g: 85, b: 13}]), ramp_orange);
One can also get the corresponding `Palette` enum variant from it's name as a String as it implements the `FromStr` trait.
use colorbrewer::*;
let blue_pal: Palette = "Blues".parse().unwrap();
assert_eq!(blue_pal, Palette::Blues);
let ramp = get_color_ramp(blue_pal, 3);
Colors are described by their hexadecimal code.
These color specifications and designs are developed by Cynthia Brewer (http://colorbrewer2.org/).
Enums§
- Palette
- Available color palettes
Functions§
- get_
color_ ramp - Function to get the requested color ramp
according to a given name and number of colors.
Return
None
if there is no color ramp defined for this value ofnb_value
.