colorgrad 0.8.0

Color scales library for data visualization, charts, games, generative art and others.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use colorgrad::Color;

#[allow(dead_code)]
pub fn colors2hex(colors: &[Color]) -> Vec<String> {
    let mut res = Vec::with_capacity(colors.len());
    for c in colors {
        res.push(c.to_css_hex());
    }
    res
}

#[macro_export]
macro_rules! cmp_hex {
    ($color:expr, $hex:expr) => {
        assert_eq!($color.to_css_hex(), $hex);
    };
}