mod css;
pub(crate) mod hex;
pub(crate) mod hsl;
pub(crate) mod rgb;
pub use hex::{format_hex, format_hex8};
pub use hsl::format_hsl;
pub use rgb::format_rgb;
use crate::color::Color;
pub fn format_css(color: &Color) -> String {
match color {
Color::Rgb(c) => css::format_color_fn("srgb", &[c.r, c.g, c.b], c.alpha),
Color::LinearRgb(c) => css::format_color_fn("srgb-linear", &[c.r, c.g, c.b], c.alpha),
Color::Hsv(c) => css::format_color_fn("--hsv", &[c.h, c.s, c.v], c.alpha),
Color::Xyz65(c) => css::format_color_fn("xyz-d65", &[c.x, c.y, c.z], c.alpha),
Color::Xyz50(c) => css::format_color_fn("xyz-d50", &[c.x, c.y, c.z], c.alpha),
Color::Hsl(c) => css::format_hsl(c.h, c.s, c.l, c.alpha),
Color::Hwb(c) => css::format_hwb(c.h, c.w, c.b, c.alpha),
Color::Lab(c) => css::format_lab_like("lab", c.l, c.a, c.b, c.alpha),
Color::Lab65(c) => css::format_color_fn("--lab-d65", &[c.l, c.a, c.b], c.alpha),
Color::Lch(c) => css::format_lch_like("lch", c.l, c.c, c.h, c.alpha),
Color::Lch65(c) => css::format_color_fn("--lch-d65", &[c.l, c.c, c.h], c.alpha),
Color::Oklab(c) => css::format_lab_like("oklab", c.l, c.a, c.b, c.alpha),
Color::Oklch(c) => css::format_lch_like("oklch", c.l, c.c, c.h, c.alpha),
Color::P3(c) => css::format_color_fn("display-p3", &[c.r, c.g, c.b], c.alpha),
Color::Rec2020(c) => css::format_color_fn("rec2020", &[c.r, c.g, c.b], c.alpha),
Color::A98(c) => css::format_color_fn("a98-rgb", &[c.r, c.g, c.b], c.alpha),
Color::ProphotoRgb(c) => css::format_color_fn("prophoto-rgb", &[c.r, c.g, c.b], c.alpha),
Color::Cubehelix(c) => css::format_color_fn("--cubehelix", &[c.h, c.s, c.l], c.alpha),
Color::Dlab(c) => css::format_color_fn("--din99o-lab", &[c.l, c.a, c.b], c.alpha),
Color::Dlch(c) => css::format_color_fn("--din99o-lch", &[c.l, c.c, c.h], c.alpha),
Color::Jab(c) => css::format_color_fn("--jzazbz", &[c.j, c.a, c.b], c.alpha),
Color::Jch(c) => css::format_color_fn("--jzczhz", &[c.j, c.c, c.h], c.alpha),
Color::Yiq(c) => css::format_color_fn("--yiq", &[c.y, c.i, c.q], c.alpha),
Color::Hsi(c) => css::format_color_fn("--hsi", &[c.h, c.s, c.i], c.alpha),
Color::Hsluv(c) => css::format_color_fn("--hsluv", &[c.h, c.s, c.l], c.alpha),
Color::Hpluv(c) => css::format_color_fn("--hpluv", &[c.h, c.s, c.l], c.alpha),
Color::Okhsl(c) => css::format_color_fn("--okhsl", &[c.h, c.s, c.l], c.alpha),
Color::Okhsv(c) => css::format_color_fn("--okhsv", &[c.h, c.s, c.v], c.alpha),
Color::Itp(c) => css::format_color_fn("--ictcp", &[c.i, c.t, c.p], c.alpha),
Color::Xyb(c) => css::format_color_fn("--xyb", &[c.x, c.y, c.b], c.alpha),
Color::Luv(c) => css::format_color_fn("--luv", &[c.l, c.u, c.v], c.alpha),
Color::Lchuv(c) => css::format_color_fn("--lchuv", &[c.l, c.c, c.h], c.alpha),
Color::Prismatic(c) => {
css::format_color_fn_4("--prismatic", &[c.l, c.r, c.g, c.b], c.alpha)
}
}
}