mod cmyk;
mod common;
mod hex;
mod hsl;
mod hsla;
mod hsv;
mod rgb;
mod rgba;
mod traits;
pub use cmyk::CMYK;
pub use common::ColorError;
pub use hex::Hex;
pub use hsl::HSL;
pub use hsla::HSLA;
pub use hsv::HSV;
pub use rgb::RGB;
pub use rgba::RGBA;
pub use traits::*;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let _hex: Hex = "#FA0".try_into().unwrap();
let _hex: Hex = "#F7A3B8".try_into().unwrap();
let _hex: Hex = "#FF99CCD9".try_into().unwrap();
let hex: Hex = "#2bc48a".try_into().unwrap();
let rgb: RGB = hex.into();
assert_eq!(rgb.to_string(), "rgb(43,196,138)");
let rgba: RGBA = hex.into();
assert_eq!(rgba.to_string(), "rgba(43,196,138,1.00)");
let hsl: HSL = hex.into();
assert_eq!(hsl.to_string(), "hsl(157,64%,47%)");
let hsla: HSLA = hex.into();
assert_eq!(hsla.to_string(), "hsla(157,64%,47%,1.00)");
let hsv: HSV = hex.into();
assert_eq!(hsv.to_string(), "hsv(157,78%,77%)");
let cmyk: CMYK = hex.into();
assert_eq!(cmyk.to_string(), "cmyk(78,0,30,23)");
let rgb: RGB = "rgb(43,196,138)".try_into().unwrap();
let hex: Hex = rgb.into();
assert_eq!(hex.to_string(), "#2BC48A");
let rgba: RGBA = rgb.into();
assert_eq!(rgba.to_string(), "rgba(43,196,138,1.00)");
let hsl: HSL = rgb.into();
assert_eq!(hsl.to_string(), "hsl(157,64%,47%)");
let hsla: HSLA = rgb.into();
assert_eq!(hsla.to_string(), "hsla(157,64%,47%,1.00)");
let hsv: HSV = rgb.into();
assert_eq!(hsv.to_string(), "hsv(157,78%,77%)");
let cmyk: CMYK = rgb.into();
assert_eq!(cmyk.to_string(), "cmyk(78,0,30,23)");
let rgba: RGBA = "rgba(43,196,138,0.85)".try_into().unwrap();
let hex: Hex = rgba.into();
assert_eq!(hex.to_string(), "#2BC48AD8");
let rgb: RGB = rgba.into();
assert_eq!(rgb.to_string(), "rgb(74,204,155)");
let hsl: HSL = rgba.into();
assert_eq!(hsl.to_string(), "hsl(157,56%,55%)");
let hsla: HSLA = rgba.into();
assert_eq!(hsla.to_string(), "hsla(157,64%,47%,0.85)");
let hsv: HSV = rgba.into();
assert_eq!(hsv.to_string(), "hsv(157,64%,80%)");
let cmyk: CMYK = rgba.into();
assert_eq!(cmyk.to_string(), "cmyk(64,0,24,20)");
let a:Hex = "#1f883d".try_into().unwrap();
dbg!(a.grayscale().to_string());
}
}