1use std::fmt;
42
43#[derive(Debug, Clone, PartialEq)]
75pub enum Color {
76 AliceBlue,
78 AntiqueWhite,
80 Aqua,
82 Aquamarine,
83 Azure,
84 Beige,
85 Bisque,
86 Black,
87 BlanchedAlmond,
88 Blue,
89 BlueViolet,
90 Brown,
91 BurlyWood,
92 CadetBlue,
93 Chartreuse,
94 Chocolate,
95 Coral,
96 CornflowerBlue,
97 Cornsilk,
98 Crimson,
99 Cyan,
100 DarkBlue,
101 DarkCyan,
102 DarkGoldenRod,
103 DarkGray,
104 DarkGrey,
105 DarkGreen,
106 DarkKhaki,
107 DarkMagenta,
108 DarkOliveGreen,
109 DarkOrange,
110 DarkOrchid,
111 DarkRed,
112 DarkSalmon,
113 DarkSeaGreen,
114 DarkSlateBlue,
115 DarkSlateGray,
116 DarkSlateGrey,
117 DarkTurquoise,
118 DarkViolet,
119 DeepPink,
120 DeepSkyBlue,
121 DimGray,
122 DimGrey,
123 DodgerBlue,
124 FireBrick,
125 FloralWhite,
126 ForestGreen,
127 Fuchsia,
128 Gainsboro,
129 GhostWhite,
130 Gold,
131 GoldenRod,
132 Gray,
133 Grey,
134 Green,
135 GreenYellow,
136 HoneyDew,
137 HotPink,
138 IndianRed,
139 Indigo,
140 Ivory,
141 Khaki,
142 Lavender,
143 LavenderBlush,
144 LawnGreen,
145 LemonChiffon,
146 LightBlue,
147 LightCoral,
148 LightCyan,
149 LightGoldenRodYellow,
150 LightGray,
151 LightGrey,
152 LightGreen,
153 LightPink,
154 LightSalmon,
155 LightSeaGreen,
156 LightSkyBlue,
157 LightSlateGray,
158 LightSlateGrey,
159 LightSteelBlue,
160 LightYellow,
161 Lime,
162 LimeGreen,
163 Linen,
164 Magenta,
165 Maroon,
166 MediumAquaMarine,
167 MediumBlue,
168 MediumOrchid,
169 MediumPurple,
170 MediumSeaGreen,
171 MediumSlateBlue,
172 MediumSpringGreen,
173 MediumTurquoise,
174 MediumVioletRed,
175 MidnightBlue,
176 MintCream,
177 MistyRose,
178 Moccasin,
179 NavajoWhite,
180 Navy,
181 OldLace,
182 Olive,
183 OliveDrab,
184 Orange,
185 OrangeRed,
186 Orchid,
187 PaleGoldenRod,
188 PaleGreen,
189 PaleTurquoise,
190 PaleVioletRed,
191 PapayaWhip,
192 PeachPuff,
193 Peru,
194 Pink,
195 Plum,
196 PowderBlue,
197 Purple,
198 RebeccaPurple,
199 Red,
200 RosyBrown,
201 RoyalBlue,
202 SaddleBrown,
203 Salmon,
204 SandyBrown,
205 SeaGreen,
206 SeaShell,
207 Sienna,
208 Silver,
209 SkyBlue,
210 SlateBlue,
211 SlateGray,
212 SlateGrey,
213 Snow,
214 SpringGreen,
215 SteelBlue,
216 Tan,
217 Teal,
218 Thistle,
219 Tomato,
220 Turquoise,
221 Violet,
222 Wheat,
223 White,
224 WhiteSmoke,
225 Yellow,
226 YellowGreen,
227
228 Transparent,
230
231 Rgb(u8, u8, u8),
233
234 Rgba(u8, u8, u8, f32),
236
237 Hex(String),
239
240 Hsl(u16, u8, u8),
242
243 Hsla(u16, u8, u8, f32),
245
246 CurrentColor,
248
249 Inherit,
251
252 Var(crate::variable::CssVar),
254}
255
256impl fmt::Display for Color {
257 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
258 match self {
259 Color::AliceBlue => write!(f, "aliceblue"),
260 Color::AntiqueWhite => write!(f, "antiquewhite"),
261 Color::Aqua => write!(f, "aqua"),
262 Color::Aquamarine => write!(f, "aquamarine"),
263 Color::Azure => write!(f, "azure"),
264 Color::Beige => write!(f, "beige"),
265 Color::Bisque => write!(f, "bisque"),
266 Color::Black => write!(f, "black"),
267 Color::BlanchedAlmond => write!(f, "blanchedalmond"),
268 Color::Blue => write!(f, "blue"),
269 Color::BlueViolet => write!(f, "blueviolet"),
270 Color::Brown => write!(f, "brown"),
271 Color::BurlyWood => write!(f, "burlywood"),
272 Color::CadetBlue => write!(f, "cadetblue"),
273 Color::Chartreuse => write!(f, "chartreuse"),
274 Color::Chocolate => write!(f, "chocolate"),
275 Color::Coral => write!(f, "coral"),
276 Color::CornflowerBlue => write!(f, "cornflowerblue"),
277 Color::Cornsilk => write!(f, "cornsilk"),
278 Color::Crimson => write!(f, "crimson"),
279 Color::Cyan => write!(f, "cyan"),
280 Color::DarkBlue => write!(f, "darkblue"),
281 Color::DarkCyan => write!(f, "darkcyan"),
282 Color::DarkGoldenRod => write!(f, "darkgoldenrod"),
283 Color::DarkGray => write!(f, "darkgray"),
284 Color::DarkGrey => write!(f, "darkgrey"),
285 Color::DarkGreen => write!(f, "darkgreen"),
286 Color::DarkKhaki => write!(f, "darkkhaki"),
287 Color::DarkMagenta => write!(f, "darkmagenta"),
288 Color::DarkOliveGreen => write!(f, "darkolivegreen"),
289 Color::DarkOrange => write!(f, "darkorange"),
290 Color::DarkOrchid => write!(f, "darkorchid"),
291 Color::DarkRed => write!(f, "darkred"),
292 Color::DarkSalmon => write!(f, "darksalmon"),
293 Color::DarkSeaGreen => write!(f, "darkseagreen"),
294 Color::DarkSlateBlue => write!(f, "darkslateblue"),
295 Color::DarkSlateGray => write!(f, "darkslategray"),
296 Color::DarkSlateGrey => write!(f, "darkslategrey"),
297 Color::DarkTurquoise => write!(f, "darkturquoise"),
298 Color::DarkViolet => write!(f, "darkviolet"),
299 Color::DeepPink => write!(f, "deeppink"),
300 Color::DeepSkyBlue => write!(f, "deepskyblue"),
301 Color::DimGray => write!(f, "dimgray"),
302 Color::DimGrey => write!(f, "dimgrey"),
303 Color::DodgerBlue => write!(f, "dodgerblue"),
304 Color::FireBrick => write!(f, "firebrick"),
305 Color::FloralWhite => write!(f, "floralwhite"),
306 Color::ForestGreen => write!(f, "forestgreen"),
307 Color::Fuchsia => write!(f, "fuchsia"),
308 Color::Gainsboro => write!(f, "gainsboro"),
309 Color::GhostWhite => write!(f, "ghostwhite"),
310 Color::Gold => write!(f, "gold"),
311 Color::GoldenRod => write!(f, "goldenrod"),
312 Color::Gray => write!(f, "gray"),
313 Color::Grey => write!(f, "grey"),
314 Color::Green => write!(f, "green"),
315 Color::GreenYellow => write!(f, "greenyellow"),
316 Color::HoneyDew => write!(f, "honeydew"),
317 Color::HotPink => write!(f, "hotpink"),
318 Color::IndianRed => write!(f, "indianred"),
319 Color::Indigo => write!(f, "indigo"),
320 Color::Ivory => write!(f, "ivory"),
321 Color::Khaki => write!(f, "khaki"),
322 Color::Lavender => write!(f, "lavender"),
323 Color::LavenderBlush => write!(f, "lavenderblush"),
324 Color::LawnGreen => write!(f, "lawngreen"),
325 Color::LemonChiffon => write!(f, "lemonchiffon"),
326 Color::LightBlue => write!(f, "lightblue"),
327 Color::LightCoral => write!(f, "lightcoral"),
328 Color::LightCyan => write!(f, "lightcyan"),
329 Color::LightGoldenRodYellow => write!(f, "lightgoldenrodyellow"),
330 Color::LightGray => write!(f, "lightgray"),
331 Color::LightGrey => write!(f, "lightgrey"),
332 Color::LightGreen => write!(f, "lightgreen"),
333 Color::LightPink => write!(f, "lightpink"),
334 Color::LightSalmon => write!(f, "lightsalmon"),
335 Color::LightSeaGreen => write!(f, "lightseagreen"),
336 Color::LightSkyBlue => write!(f, "lightskyblue"),
337 Color::LightSlateGray => write!(f, "lightslategray"),
338 Color::LightSlateGrey => write!(f, "lightslategrey"),
339 Color::LightSteelBlue => write!(f, "lightsteelblue"),
340 Color::LightYellow => write!(f, "lightyellow"),
341 Color::Lime => write!(f, "lime"),
342 Color::LimeGreen => write!(f, "limegreen"),
343 Color::Linen => write!(f, "linen"),
344 Color::Magenta => write!(f, "magenta"),
345 Color::Maroon => write!(f, "maroon"),
346 Color::MediumAquaMarine => write!(f, "mediumaquamarine"),
347 Color::MediumBlue => write!(f, "mediumblue"),
348 Color::MediumOrchid => write!(f, "mediumorchid"),
349 Color::MediumPurple => write!(f, "mediumpurple"),
350 Color::MediumSeaGreen => write!(f, "mediumseagreen"),
351 Color::MediumSlateBlue => write!(f, "mediumslateblue"),
352 Color::MediumSpringGreen => write!(f, "mediumspringgreen"),
353 Color::MediumTurquoise => write!(f, "mediumturquoise"),
354 Color::MediumVioletRed => write!(f, "mediumvioletred"),
355 Color::MidnightBlue => write!(f, "midnightblue"),
356 Color::MintCream => write!(f, "mintcream"),
357 Color::MistyRose => write!(f, "mistyrose"),
358 Color::Moccasin => write!(f, "moccasin"),
359 Color::NavajoWhite => write!(f, "navajowhite"),
360 Color::Navy => write!(f, "navy"),
361 Color::OldLace => write!(f, "oldlace"),
362 Color::Olive => write!(f, "olive"),
363 Color::OliveDrab => write!(f, "olivedrab"),
364 Color::Orange => write!(f, "orange"),
365 Color::OrangeRed => write!(f, "orangered"),
366 Color::Orchid => write!(f, "orchid"),
367 Color::PaleGoldenRod => write!(f, "palegoldenrod"),
368 Color::PaleGreen => write!(f, "palegreen"),
369 Color::PaleTurquoise => write!(f, "paleturquoise"),
370 Color::PaleVioletRed => write!(f, "palevioletred"),
371 Color::PapayaWhip => write!(f, "papayawhip"),
372 Color::PeachPuff => write!(f, "peachpuff"),
373 Color::Peru => write!(f, "peru"),
374 Color::Pink => write!(f, "pink"),
375 Color::Plum => write!(f, "plum"),
376 Color::PowderBlue => write!(f, "powderblue"),
377 Color::Purple => write!(f, "purple"),
378 Color::RebeccaPurple => write!(f, "rebeccapurple"),
379 Color::Red => write!(f, "red"),
380 Color::RosyBrown => write!(f, "rosybrown"),
381 Color::RoyalBlue => write!(f, "royalblue"),
382 Color::SaddleBrown => write!(f, "saddlebrown"),
383 Color::Salmon => write!(f, "salmon"),
384 Color::SandyBrown => write!(f, "sandybrown"),
385 Color::SeaGreen => write!(f, "seagreen"),
386 Color::SeaShell => write!(f, "seashell"),
387 Color::Sienna => write!(f, "sienna"),
388 Color::Silver => write!(f, "silver"),
389 Color::SkyBlue => write!(f, "skyblue"),
390 Color::SlateBlue => write!(f, "slateblue"),
391 Color::SlateGray => write!(f, "slategray"),
392 Color::SlateGrey => write!(f, "slategrey"),
393 Color::Snow => write!(f, "snow"),
394 Color::SpringGreen => write!(f, "springgreen"),
395 Color::SteelBlue => write!(f, "steelblue"),
396 Color::Tan => write!(f, "tan"),
397 Color::Teal => write!(f, "teal"),
398 Color::Thistle => write!(f, "thistle"),
399 Color::Tomato => write!(f, "tomato"),
400 Color::Turquoise => write!(f, "turquoise"),
401 Color::Violet => write!(f, "violet"),
402 Color::Wheat => write!(f, "wheat"),
403 Color::White => write!(f, "white"),
404 Color::WhiteSmoke => write!(f, "whitesmoke"),
405 Color::Yellow => write!(f, "yellow"),
406 Color::YellowGreen => write!(f, "yellowgreen"),
407 Color::Transparent => write!(f, "transparent"),
408 Color::Rgb(r, g, b) => write!(f, "rgb({}, {}, {})", r, g, b),
409 Color::Rgba(r, g, b, a) => write!(f, "rgba({}, {}, {}, {})", r, g, b, a),
410 Color::Hex(hex) => {
411 let hex_str = if hex.starts_with('#') { hex.clone() } else { format!("#{}", hex) };
412 write!(f, "{}", hex_str)
413 },
414 Color::Hsl(h, s, l) => write!(f, "hsl({}, {}%, {}%)", h, s, l),
415 Color::Hsla(h, s, l, a) => write!(f, "hsla({}, {}%, {}%, {})", h, s, l, a),
416 Color::CurrentColor => write!(f, "currentColor"),
417 Color::Inherit => write!(f, "inherit"),
418 Color::Var(var) => write!(f, "{}", var),
419 }
420 }
421}
422
423#[derive(Debug, Clone, PartialEq)]
464pub enum Size {
465 Zero,
467
468 Px(u32),
470 Percent(f32),
472 Em(f32),
474 Rem(f32),
476 Vw(f32),
478 Vh(f32),
480 Auto,
482 Var(crate::variable::CssVar),
484}
485
486impl fmt::Display for Size {
487 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
488 match self {
489 Size::Zero => write!(f, "0"),
490 Size::Px(val) => write!(f, "{}px", val),
491 Size::Percent(val) => write!(f, "{}%", val),
492 Size::Em(val) => write!(f, "{}em", val),
493 Size::Rem(val) => write!(f, "{}rem", val),
494 Size::Vw(val) => write!(f, "{}vw", val),
495 Size::Vh(val) => write!(f, "{}vh", val),
496 Size::Auto => write!(f, "auto"),
497 Size::Var(var) => write!(f, "{}", var),
498 }
499 }
500}
501
502#[derive(Debug, Clone, PartialEq)]
529pub enum Display {
530 None,
532 Block,
534 Inline,
536 InlineBlock,
538 Flex,
540 Grid,
542 Table,
544 Var(crate::variable::CssVar),
546}
547
548impl fmt::Display for Display {
549 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
550 match self {
551 Display::None => write!(f, "none"),
552 Display::Block => write!(f, "block"),
553 Display::Inline => write!(f, "inline"),
554 Display::InlineBlock => write!(f, "inline-block"),
555 Display::Flex => write!(f, "flex"),
556 Display::Grid => write!(f, "grid"),
557 Display::Table => write!(f, "table"),
558 Display::Var(var) => write!(f, "{}", var),
559 }
560 }
561}
562
563#[derive(Debug, Clone, PartialEq)]
600pub enum Position {
601 Static,
603 Relative,
605 Absolute,
607 Fixed,
609 Sticky,
611 Var(crate::variable::CssVar),
613}
614
615impl fmt::Display for Position {
616 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
617 match self {
618 Position::Static => write!(f, "static"),
619 Position::Relative => write!(f, "relative"),
620 Position::Absolute => write!(f, "absolute"),
621 Position::Fixed => write!(f, "fixed"),
622 Position::Sticky => write!(f, "sticky"),
623 Position::Var(var) => write!(f, "{}", var),
624 }
625 }
626}
627
628#[derive(Debug, Clone, PartialEq)]
630pub enum FlexDirection {
631 Row,
632 RowReverse,
633 Column,
634 ColumnReverse,
635 Var(crate::variable::CssVar),
637}
638
639impl fmt::Display for FlexDirection {
640 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
641 match self {
642 FlexDirection::Row => write!(f, "row"),
643 FlexDirection::RowReverse => write!(f, "row-reverse"),
644 FlexDirection::Column => write!(f, "column"),
645 FlexDirection::ColumnReverse => write!(f, "column-reverse"),
646 FlexDirection::Var(var) => write!(f, "{}", var),
647 }
648 }
649}
650
651#[derive(Debug, Clone, PartialEq)]
653pub enum JustifyContent {
654 FlexStart,
655 FlexEnd,
656 Center,
657 SpaceBetween,
658 SpaceAround,
659 SpaceEvenly,
660 Var(crate::variable::CssVar),
662}
663
664impl fmt::Display for JustifyContent {
665 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
666 match self {
667 JustifyContent::FlexStart => write!(f, "flex-start"),
668 JustifyContent::FlexEnd => write!(f, "flex-end"),
669 JustifyContent::Center => write!(f, "center"),
670 JustifyContent::SpaceBetween => write!(f, "space-between"),
671 JustifyContent::SpaceAround => write!(f, "space-around"),
672 JustifyContent::SpaceEvenly => write!(f, "space-evenly"),
673 JustifyContent::Var(var) => write!(f, "{}", var),
674 }
675 }
676}
677
678#[derive(Debug, Clone, PartialEq)]
680pub enum AlignItems {
681 FlexStart,
682 FlexEnd,
683 Center,
684 Baseline,
685 Stretch,
686 Var(crate::variable::CssVar),
688}
689
690impl fmt::Display for AlignItems {
691 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
692 match self {
693 AlignItems::FlexStart => write!(f, "flex-start"),
694 AlignItems::FlexEnd => write!(f, "flex-end"),
695 AlignItems::Center => write!(f, "center"),
696 AlignItems::Baseline => write!(f, "baseline"),
697 AlignItems::Stretch => write!(f, "stretch"),
698 AlignItems::Var(var) => write!(f, "{}", var),
699 }
700 }
701}
702
703#[derive(Debug, Clone, PartialEq)]
705pub enum FontWeight {
706 Normal,
707 Bold,
708 Bolder,
709 Lighter,
710 Weight(u16),
712 Var(crate::variable::CssVar),
714}
715
716impl fmt::Display for FontWeight {
717 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
718 match self {
719 FontWeight::Normal => write!(f, "normal"),
720 FontWeight::Bold => write!(f, "bold"),
721 FontWeight::Bolder => write!(f, "bolder"),
722 FontWeight::Lighter => write!(f, "lighter"),
723 FontWeight::Weight(w) => {
724 if *w >= 100 && *w <= 900 && w % 100 == 0 {
726 write!(f, "{}", w)
727 } else {
728 write!(f, "400") }
730 },
731 FontWeight::Var(var) => write!(f, "{}", var),
732 }
733 }
734}
735
736#[derive(Debug, Clone, PartialEq)]
738pub enum TextAlign {
739 Left,
740 Right,
741 Center,
742 Justify,
743 Start,
744 End,
745 Var(crate::variable::CssVar),
747}
748
749impl fmt::Display for TextAlign {
750 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
751 match self {
752 TextAlign::Left => write!(f, "left"),
753 TextAlign::Right => write!(f, "right"),
754 TextAlign::Center => write!(f, "center"),
755 TextAlign::Justify => write!(f, "justify"),
756 TextAlign::Start => write!(f, "start"),
757 TextAlign::End => write!(f, "end"),
758 TextAlign::Var(var) => write!(f, "{}", var),
759 }
760 }
761}
762
763#[derive(Debug, Clone, PartialEq)]
765pub enum TextDecoration {
766 None,
767 Underline,
768 Overline,
769 LineThrough,
770 Var(crate::variable::CssVar),
772}
773
774impl fmt::Display for TextDecoration {
775 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
776 match self {
777 TextDecoration::None => write!(f, "none"),
778 TextDecoration::Underline => write!(f, "underline"),
779 TextDecoration::Overline => write!(f, "overline"),
780 TextDecoration::LineThrough => write!(f, "line-through"),
781 TextDecoration::Var(var) => write!(f, "{}", var),
782 }
783 }
784}
785
786#[derive(Debug, Clone, PartialEq)]
788pub enum Overflow {
789 Visible,
790 Hidden,
791 Scroll,
792 Auto,
793 Clip,
794 Var(crate::variable::CssVar),
796}
797
798impl fmt::Display for Overflow {
799 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
800 match self {
801 Overflow::Visible => write!(f, "visible"),
802 Overflow::Hidden => write!(f, "hidden"),
803 Overflow::Scroll => write!(f, "scroll"),
804 Overflow::Auto => write!(f, "auto"),
805 Overflow::Clip => write!(f, "clip"),
806 Overflow::Var(var) => write!(f, "{}", var),
807 }
808 }
809}
810
811#[derive(Debug, Clone, PartialEq)]
813pub enum Cursor {
814 Default,
815 Pointer,
816 Text,
817 NotAllowed,
818 Wait,
819 Move,
820 Grab,
821 ZoomIn,
822 ZoomOut,
823 Var(crate::variable::CssVar),
825}
826
827impl fmt::Display for Cursor {
828 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
829 match self {
830 Cursor::Default => write!(f, "default"),
831 Cursor::Pointer => write!(f, "pointer"),
832 Cursor::Text => write!(f, "text"),
833 Cursor::NotAllowed => write!(f, "not-allowed"),
834 Cursor::Wait => write!(f, "wait"),
835 Cursor::Move => write!(f, "move"),
836 Cursor::Grab => write!(f, "grab"),
837 Cursor::ZoomIn => write!(f, "zoom-in"),
838 Cursor::ZoomOut => write!(f, "zoom-out"),
839 Cursor::Var(var) => write!(f, "{}", var),
840 }
841 }
842}
843
844#[derive(Debug, Clone, PartialEq)]
846pub enum Visibility {
847 Visible,
848 Hidden,
849 Collapse,
850 Var(crate::variable::CssVar),
852}
853
854impl fmt::Display for Visibility {
855 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
856 match self {
857 Visibility::Visible => write!(f, "visible"),
858 Visibility::Hidden => write!(f, "hidden"),
859 Visibility::Collapse => write!(f, "collapse"),
860 Visibility::Var(var) => write!(f, "{}", var),
861 }
862 }
863}
864
865#[derive(Debug, Clone, PartialEq)]
867pub enum BorderStyle {
868 None,
869 Solid,
870 Dashed,
871 Dotted,
872 Double,
873 Groove,
874 Ridge,
875 Inset,
876 Outset,
877 Var(crate::variable::CssVar),
879}
880
881impl fmt::Display for BorderStyle {
882 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
883 match self {
884 BorderStyle::None => write!(f, "none"),
885 BorderStyle::Solid => write!(f, "solid"),
886 BorderStyle::Dashed => write!(f, "dashed"),
887 BorderStyle::Dotted => write!(f, "dotted"),
888 BorderStyle::Double => write!(f, "double"),
889 BorderStyle::Groove => write!(f, "groove"),
890 BorderStyle::Ridge => write!(f, "ridge"),
891 BorderStyle::Inset => write!(f, "inset"),
892 BorderStyle::Outset => write!(f, "outset"),
893 BorderStyle::Var(var) => write!(f, "{}", var),
894 }
895 }
896}
897
898#[derive(Debug, Clone, PartialEq)]
900pub enum FontSize {
901 Px(u32),
903 Percent(f32),
905 Em(f32),
907 Rem(f32),
909 Smaller,
911 Larger,
913 XxSmall,
915 XSmall,
916 Small,
917 Medium,
918 Large,
919 XLarge,
920 XxLarge,
921 Calc(String),
923 Var(crate::variable::CssVar),
925}
926
927impl fmt::Display for FontSize {
928 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
929 match self {
930 FontSize::Px(val) => write!(f, "{}px", val),
931 FontSize::Percent(val) => write!(f, "{}%", val),
932 FontSize::Em(val) => write!(f, "{}em", val),
933 FontSize::Rem(val) => write!(f, "{}rem", val),
934 FontSize::Smaller => write!(f, "smaller"),
935 FontSize::Larger => write!(f, "larger"),
936 FontSize::XxSmall => write!(f, "xx-small"),
937 FontSize::XSmall => write!(f, "x-small"),
938 FontSize::Small => write!(f, "small"),
939 FontSize::Medium => write!(f, "medium"),
940 FontSize::Large => write!(f, "large"),
941 FontSize::XLarge => write!(f, "x-large"),
942 FontSize::XxLarge => write!(f, "xx-large"),
943 FontSize::Calc(expr) => write!(f, "calc({})", expr),
944 FontSize::Var(var) => write!(f, "{}", var),
945 }
946 }
947}
948
949#[derive(Debug, Clone, PartialEq)]
951pub enum LineHeight {
952 Normal,
954 Number(f32),
956 Length(Size),
958 Percent(f32),
960 Calc(String),
962 Var(crate::variable::CssVar),
964}
965
966impl fmt::Display for LineHeight {
967 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
968 match self {
969 LineHeight::Normal => write!(f, "normal"),
970 LineHeight::Number(val) => write!(f, "{}", val),
971 LineHeight::Length(size) => write!(f, "{}", size),
972 LineHeight::Percent(val) => write!(f, "{}%", val),
973 LineHeight::Calc(expr) => write!(f, "calc({})", expr),
974 LineHeight::Var(var) => write!(f, "{}", var),
975 }
976 }
977}
978
979#[derive(Debug, Clone, PartialEq)]
981pub struct BoxShadow {
982 pub h_offset: Size,
983 pub v_offset: Size,
984 pub blur: Option<Size>,
985 pub spread: Option<Size>,
986 pub color: Option<Color>,
987 pub inset: bool,
988}
989
990impl fmt::Display for BoxShadow {
991 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
992 if self.inset {
993 write!(f, "inset ")?;
994 }
995
996 write!(f, "{} {}", self.h_offset, self.v_offset)?;
997
998 if let Some(blur) = &self.blur {
999 write!(f, " {}", blur)?;
1000 }
1001
1002 if let Some(spread) = &self.spread {
1003 write!(f, " {}", spread)?;
1004 }
1005
1006 if let Some(color) = &self.color {
1007 write!(f, " {}", color)?;
1008 }
1009
1010 Ok(())
1011 }
1012}
1013
1014#[derive(Debug, Clone, PartialEq)]
1016pub struct Transition {
1017 pub property: String,
1018 pub duration: f32,
1019 pub timing_function: Option<String>,
1020 pub delay: Option<f32>,
1021}
1022
1023impl fmt::Display for Transition {
1024 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1025 write!(f, "{} {}s", self.property, self.duration)?;
1026
1027 if let Some(timing) = &self.timing_function {
1028 write!(f, " {}", timing)?;
1029 }
1030
1031 if let Some(delay) = self.delay {
1032 write!(f, " {}s", delay)?;
1033 }
1034
1035 Ok(())
1036 }
1037}
1038
1039#[derive(Debug, Clone, PartialEq)]
1041pub enum ZIndex {
1042 Auto,
1043 Index(i32),
1044 Var(crate::variable::CssVar),
1046}
1047
1048impl fmt::Display for ZIndex {
1049 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1050 match self {
1051 ZIndex::Auto => write!(f, "auto"),
1052 ZIndex::Index(val) => write!(f, "{}", val),
1053 ZIndex::Var(var) => write!(f, "{}", var),
1054 }
1055 }
1056}
1057
1058impl From<crate::variable::CssVar> for Color {
1060 fn from(var: crate::variable::CssVar) -> Self {
1061 Color::Var(var)
1062 }
1063}
1064
1065impl From<crate::variable::CssVar> for Size {
1067 fn from(var: crate::variable::CssVar) -> Self {
1068 Size::Var(var)
1069 }
1070}
1071
1072impl From<crate::variable::CssVar> for Display {
1074 fn from(var: crate::variable::CssVar) -> Self {
1075 Display::Var(var)
1076 }
1077}
1078
1079impl From<crate::variable::CssVar> for Position {
1081 fn from(var: crate::variable::CssVar) -> Self {
1082 Position::Var(var)
1083 }
1084}
1085
1086impl From<crate::variable::CssVar> for FlexDirection {
1088 fn from(var: crate::variable::CssVar) -> Self {
1089 FlexDirection::Var(var)
1090 }
1091}
1092
1093impl From<crate::variable::CssVar> for JustifyContent {
1095 fn from(var: crate::variable::CssVar) -> Self {
1096 JustifyContent::Var(var)
1097 }
1098}
1099
1100impl From<crate::variable::CssVar> for AlignItems {
1102 fn from(var: crate::variable::CssVar) -> Self {
1103 AlignItems::Var(var)
1104 }
1105}
1106
1107impl From<crate::variable::CssVar> for FontWeight {
1109 fn from(var: crate::variable::CssVar) -> Self {
1110 FontWeight::Var(var)
1111 }
1112}
1113
1114impl From<crate::variable::CssVar> for TextAlign {
1116 fn from(var: crate::variable::CssVar) -> Self {
1117 TextAlign::Var(var)
1118 }
1119}
1120
1121impl From<crate::variable::CssVar> for TextDecoration {
1123 fn from(var: crate::variable::CssVar) -> Self {
1124 TextDecoration::Var(var)
1125 }
1126}
1127
1128impl From<crate::variable::CssVar> for Overflow {
1130 fn from(var: crate::variable::CssVar) -> Self {
1131 Overflow::Var(var)
1132 }
1133}
1134
1135impl From<crate::variable::CssVar> for Cursor {
1137 fn from(var: crate::variable::CssVar) -> Self {
1138 Cursor::Var(var)
1139 }
1140}
1141
1142impl From<crate::variable::CssVar> for Visibility {
1144 fn from(var: crate::variable::CssVar) -> Self {
1145 Visibility::Var(var)
1146 }
1147}
1148
1149impl From<crate::variable::CssVar> for BorderStyle {
1151 fn from(var: crate::variable::CssVar) -> Self {
1152 BorderStyle::Var(var)
1153 }
1154}
1155
1156impl From<crate::variable::CssVar> for ZIndex {
1158 fn from(var: crate::variable::CssVar) -> Self {
1159 ZIndex::Var(var)
1160 }
1161}
1162
1163impl From<crate::variable::CssVar> for FontSize {
1165 fn from(var: crate::variable::CssVar) -> Self {
1166 FontSize::Var(var)
1167 }
1168}
1169
1170impl From<crate::variable::CssVar> for LineHeight {
1172 fn from(var: crate::variable::CssVar) -> Self {
1173 LineHeight::Var(var)
1174 }
1175}