use serde::{Deserialize, Serialize};
use std::fmt::Display;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum Color {
AliceBlue,
AntiqueWhite,
Aqua,
Aquamarine,
Azure,
Beige,
Bisque,
Black,
BlanchedAlmond,
Blue,
BlueViolet,
Brown,
BurlyWood,
CadetBlue,
Chartreuse,
Chocolate,
Coral,
CornflowerBlue,
Cornsilk,
Crimson,
Cyan,
DarkBlue,
DarkCyan,
DarkGoldenRod,
DarkGray,
DarkGrey,
DarkGreen,
DarkKhaki,
DarkMagenta,
DarkOliveGreen,
DarkOrange,
DarkOrchid,
DarkRed,
DarkSalmon,
DarkSeaGreen,
DarkSlateBlue,
DarkSlateGray,
DarkSlateGrey,
DarkTurquoise,
DarkViolet,
DeepPink,
DeepSkyBlue,
DimGray,
DimGrey,
DodgerBlue,
FireBrick,
FloralWhite,
ForestGreen,
Fuchsia,
Gainsboro,
GhostWhite,
Gold,
GoldenRod,
Gray,
Grey,
Green,
GreenYellow,
HoneyDew,
HotPink,
IndianRed,
Indigo,
Ivory,
Khaki,
Lavender,
LavenderBlush,
LawnGreen,
LemonChiffon,
LightBlue,
LightCoral,
LightCyan,
LightGoldenRodYellow,
LightGray,
LightGrey,
LightGreen,
LightPink,
LightSalmon,
LightSeaGreen,
LightSkyBlue,
LightSlateGray,
LightSlateGrey,
LightSteelBlue,
LightYellow,
Lime,
LimeGreen,
Linen,
Magenta,
Maroon,
MediumAquaMarine,
MediumBlue,
MediumOrchid,
MediumPurple,
MediumSeaGreen,
MediumSlateBlue,
MediumSpringGreen,
MediumTurquoise,
MediumVioletRed,
MidnightBlue,
MintCream,
MistyRose,
Moccasin,
NavajoWhite,
Navy,
OldLace,
Olive,
OliveDrab,
Orange,
OrangeRed,
Orchid,
PaleGoldenRod,
PaleGreen,
PaleTurquoise,
PaleVioletRed,
PapayaWhip,
PeachPuff,
Peru,
Pink,
Plum,
PowderBlue,
Purple,
RebeccaPurple,
Red,
RosyBrown,
RoyalBlue,
SaddleBrown,
Salmon,
SandyBrown,
SeaGreen,
SeaShell,
Sienna,
Silver,
SkyBlue,
SlateBlue,
SlateGray,
SlateGrey,
Snow,
SpringGreen,
SteelBlue,
Tan,
Teal,
Thistle,
Tomato,
Turquoise,
Violet,
Wheat,
White,
WhiteSmoke,
Yellow,
YellowGreen,
Transparent,
CurrentColor,
Rgb(u8, u8, u8),
Rgba(u8, u8, u8, f32),
Hsl(u16, u8, u8),
Hsla(u16, u8, u8, f32),
Hex(String),
Custom(String),
}
impl Display for Color {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let str = match &self {
Color::AliceBlue => "aliceblue".to_string(),
Color::AntiqueWhite => "antiquewhite".to_string(),
Color::Aqua => "aqua".to_string(),
Color::Aquamarine => "aquamarine".to_string(),
Color::Azure => "azure".to_string(),
Color::Beige => "beige".to_string(),
Color::Bisque => "bisque".to_string(),
Color::Black => "black".to_string(),
Color::BlanchedAlmond => "blanchedalmond".to_string(),
Color::Blue => "blue".to_string(),
Color::BlueViolet => "blueviolet".to_string(),
Color::Brown => "brown".to_string(),
Color::BurlyWood => "burlywood".to_string(),
Color::CadetBlue => "cadetblue".to_string(),
Color::Chartreuse => "chartreuse".to_string(),
Color::Chocolate => "chocolate".to_string(),
Color::Coral => "coral".to_string(),
Color::CornflowerBlue => "cornflowerblue".to_string(),
Color::Cornsilk => "cornsilk".to_string(),
Color::Crimson => "crimson".to_string(),
Color::Cyan => "cyan".to_string(),
Color::DarkBlue => "darkblue".to_string(),
Color::DarkCyan => "darkcyan".to_string(),
Color::DarkGoldenRod => "darkgoldenrod".to_string(),
Color::DarkGray => "darkgray".to_string(),
Color::DarkGrey => "darkgrey".to_string(),
Color::DarkGreen => "darkgreen".to_string(),
Color::DarkKhaki => "darkkhaki".to_string(),
Color::DarkMagenta => "darkmagenta".to_string(),
Color::DarkOliveGreen => "darkolivegreen".to_string(),
Color::DarkOrange => "darkorange".to_string(),
Color::DarkOrchid => "darkorchid".to_string(),
Color::DarkRed => "darkred".to_string(),
Color::DarkSalmon => "darksalmon".to_string(),
Color::DarkSeaGreen => "darkseagreen".to_string(),
Color::DarkSlateBlue => "darkslateblue".to_string(),
Color::DarkSlateGray => "darkslategray".to_string(),
Color::DarkSlateGrey => "darkslategrey".to_string(),
Color::DarkTurquoise => "darkturquoise".to_string(),
Color::DarkViolet => "darkviolet".to_string(),
Color::DeepPink => "deeppink".to_string(),
Color::DeepSkyBlue => "deepskyblue".to_string(),
Color::DimGray => "dimgray".to_string(),
Color::DimGrey => "dimgrey".to_string(),
Color::DodgerBlue => "dodgerblue".to_string(),
Color::FireBrick => "firebrick".to_string(),
Color::FloralWhite => "floralwhite".to_string(),
Color::ForestGreen => "forestgreen".to_string(),
Color::Fuchsia => "fuchsia".to_string(),
Color::Gainsboro => "gainsboro".to_string(),
Color::GhostWhite => "ghostwhite".to_string(),
Color::Gold => "gold".to_string(),
Color::GoldenRod => "goldenrod".to_string(),
Color::Gray => "gray".to_string(),
Color::Grey => "grey".to_string(),
Color::Green => "green".to_string(),
Color::GreenYellow => "greenyellow".to_string(),
Color::HoneyDew => "honeydew".to_string(),
Color::HotPink => "hotpink".to_string(),
Color::IndianRed => "indianred".to_string(),
Color::Indigo => "indigo".to_string(),
Color::Ivory => "ivory".to_string(),
Color::Khaki => "khaki".to_string(),
Color::Lavender => "lavender".to_string(),
Color::LavenderBlush => "lavenderblush".to_string(),
Color::LawnGreen => "lawngreen".to_string(),
Color::LemonChiffon => "lemonchiffon".to_string(),
Color::LightBlue => "lightblue".to_string(),
Color::LightCoral => "lightcoral".to_string(),
Color::LightCyan => "lightcyan".to_string(),
Color::LightGoldenRodYellow => "lightgoldenrodyellow".to_string(),
Color::LightGray => "lightgray".to_string(),
Color::LightGrey => "lightgrey".to_string(),
Color::LightGreen => "lightgreen".to_string(),
Color::LightPink => "lightpink".to_string(),
Color::LightSalmon => "lightsalmon".to_string(),
Color::LightSeaGreen => "lightseagreen".to_string(),
Color::LightSkyBlue => "lightskyblue".to_string(),
Color::LightSlateGray => "lightslategray".to_string(),
Color::LightSlateGrey => "lightslategrey".to_string(),
Color::LightSteelBlue => "lightsteelblue".to_string(),
Color::LightYellow => "lightyellow".to_string(),
Color::Lime => "lime".to_string(),
Color::LimeGreen => "limegreen".to_string(),
Color::Linen => "linen".to_string(),
Color::Magenta => "magenta".to_string(),
Color::Maroon => "maroon".to_string(),
Color::MediumAquaMarine => "mediumaquamarine".to_string(),
Color::MediumBlue => "mediumblue".to_string(),
Color::MediumOrchid => "mediumorchid".to_string(),
Color::MediumPurple => "mediumpurple".to_string(),
Color::MediumSeaGreen => "mediumseagreen".to_string(),
Color::MediumSlateBlue => "mediumslateblue".to_string(),
Color::MediumSpringGreen => "mediumspringgreen".to_string(),
Color::MediumTurquoise => "mediumturquoise".to_string(),
Color::MediumVioletRed => "mediumvioletred".to_string(),
Color::MidnightBlue => "midnightblue".to_string(),
Color::MintCream => "mintcream".to_string(),
Color::MistyRose => "mistyrose".to_string(),
Color::Moccasin => "moccasin".to_string(),
Color::NavajoWhite => "navajowhite".to_string(),
Color::Navy => "navy".to_string(),
Color::OldLace => "oldlace".to_string(),
Color::Olive => "olive".to_string(),
Color::OliveDrab => "olivedrab".to_string(),
Color::Orange => "orange".to_string(),
Color::OrangeRed => "orangered".to_string(),
Color::Orchid => "orchid".to_string(),
Color::PaleGoldenRod => "palegoldenrod".to_string(),
Color::PaleGreen => "palegreen".to_string(),
Color::PaleTurquoise => "paleturquoise".to_string(),
Color::PaleVioletRed => "palevioletred".to_string(),
Color::PapayaWhip => "papayawhip".to_string(),
Color::PeachPuff => "peachpuff".to_string(),
Color::Peru => "peru".to_string(),
Color::Pink => "pink".to_string(),
Color::Plum => "plum".to_string(),
Color::PowderBlue => "powderblue".to_string(),
Color::Purple => "purple".to_string(),
Color::RebeccaPurple => "rebeccapurple".to_string(),
Color::Red => "red".to_string(),
Color::RosyBrown => "rosybrown".to_string(),
Color::RoyalBlue => "royalblue".to_string(),
Color::SaddleBrown => "saddlebrown".to_string(),
Color::Salmon => "salmon".to_string(),
Color::SandyBrown => "sandybrown".to_string(),
Color::SeaGreen => "seagreen".to_string(),
Color::SeaShell => "seashell".to_string(),
Color::Sienna => "sienna".to_string(),
Color::Silver => "silver".to_string(),
Color::SkyBlue => "skyblue".to_string(),
Color::SlateBlue => "slateblue".to_string(),
Color::SlateGray => "slategray".to_string(),
Color::SlateGrey => "slategrey".to_string(),
Color::Snow => "snow".to_string(),
Color::SpringGreen => "springgreen".to_string(),
Color::SteelBlue => "steelblue".to_string(),
Color::Tan => "tan".to_string(),
Color::Teal => "teal".to_string(),
Color::Thistle => "thistle".to_string(),
Color::Tomato => "tomato".to_string(),
Color::Turquoise => "turquoise".to_string(),
Color::Violet => "violet".to_string(),
Color::Wheat => "wheat".to_string(),
Color::White => "white".to_string(),
Color::WhiteSmoke => "whitesmoke".to_string(),
Color::Yellow => "yellow".to_string(),
Color::YellowGreen => "yellowgreen".to_string(),
Color::Transparent => "transparent".to_string(),
Color::CurrentColor => "currentColor".to_string(),
Color::Rgb(r, g, b) => format!("rgb({}, {}, {})", r, g, b),
Color::Rgba(r, g, b, a) => format!("rgba({}, {}, {}, {})", r, g, b, a),
Color::Hsl(h, s, l) => format!("hsl({}, {}%, {}%)", h, s, l),
Color::Hsla(h, s, l, a) => format!("hsla({}, {}%, {}%, {})", h, s, l, a),
Color::Hex(hex) => hex.to_string(),
Color::Custom(s) => s.to_string(),
};
write!(f, "{}", str)
}
}