1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
use std::fmt;
use super::*;

#[derive(Clone, Copy, PartialEq, Debug)]
pub struct CmyColor {
    pub c: f64, // cyan
    pub m: f64, // magenta
    pub y: f64, // yellow
}

impl fmt::Display for CmyColor {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "cmy({}%, {}%, {}%)", self.c, self.m, self.y)
    }
}

impl ToHexString for CmyColor {
    fn to_hex_string(&self) -> String {
        RgbColor::from(*self).to_hex_string()
    }
}