summaryrefslogtreecommitdiffstats
path: root/vendor/colored/src/customcolors.rs
blob: 896e92f9d1e66e15efe9bb438c9dd2192773f54d (plain)
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
/// Custom color structure, it will generate a true color in the result
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct CustomColor {
    /// Red
    pub r: u8,
    /// Green
    pub g: u8,
    /// Blue
    pub b: u8,
}

/// This only makes custom color creation easier.
impl CustomColor {
    /// Create a new custom color
    pub fn new(r: u8, g: u8, b: u8) -> Self {
        Self { r, g, b }
    }
}

#[cfg(test)]
mod tests {
    use crate::*;
    #[test]
    fn main() {
        let my_color = CustomColor::new(0, 120, 120);
        println!("{}", "Greetings from Ukraine".custom_color(my_color));
    }
}