Crate colorbrewer [] [src]


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!["#fee6ce", "#fdae6b", "#e6550d"]), 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 (



Available color palettes



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 of nb_value.