File: utils.rs

package info (click to toggle)
rust-colorgrad 0.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: makefile: 15
file content (17 lines) | stat: -rw-r--r-- 350 bytes parent folder | download
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);
    };
}