logo
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use super::*;
mod builtin;

/// In general, it is a look-up table.
///
/// When the color is automatically mixed when the interpolation expression is activated.
#[derive(Clone, Debug)]
pub struct Palette {
    /// Allow gradients?
    gradient: bool,
    /// min-width
    /// unit: px
    key_points: BTreeMap<usize, Srgb>,
}

impl Palette {
    ///
    pub fn get_color(&self, weight: usize) -> Result<Srgb> {
        match self.key_points.get(&weight) {
            Some(s) => Ok(*s),
            None if self.gradient => {
                syntax_error!("TODO")
            },
            None => {
                syntax_error!("TODO")
            },
        }
    }
}