1use std::fmt;
6
7#[derive(Debug, Clone, PartialEq)]
9pub enum Color {
10 AliceBlue,
12 AntiqueWhite,
13 Aqua,
14 Aquamarine,
15 Azure,
16 Beige,
17 Bisque,
18 Black,
19 BlanchedAlmond,
20 Blue,
21 BlueViolet,
22 Brown,
23 BurlyWood,
24 CadetBlue,
25 Chartreuse,
26 Chocolate,
27 Coral,
28 CornflowerBlue,
29 Cornsilk,
30 Crimson,
31 Cyan,
32 DarkBlue,
33 DarkCyan,
34 DarkGoldenRod,
35 DarkGray,
36 DarkGrey,
37 DarkGreen,
38 DarkKhaki,
39 DarkMagenta,
40 DarkOliveGreen,
41 DarkOrange,
42 DarkOrchid,
43 DarkRed,
44 DarkSalmon,
45 DarkSeaGreen,
46 DarkSlateBlue,
47 DarkSlateGray,
48 DarkSlateGrey,
49 DarkTurquoise,
50 DarkViolet,
51 DeepPink,
52 DeepSkyBlue,
53 DimGray,
54 DimGrey,
55 DodgerBlue,
56 FireBrick,
57 FloralWhite,
58 ForestGreen,
59 Fuchsia,
60 Gainsboro,
61 GhostWhite,
62 Gold,
63 GoldenRod,
64 Gray,
65 Grey,
66 Green,
67 GreenYellow,
68 HoneyDew,
69 HotPink,
70 IndianRed,
71 Indigo,
72 Ivory,
73 Khaki,
74 Lavender,
75 LavenderBlush,
76 LawnGreen,
77 LemonChiffon,
78 LightBlue,
79 LightCoral,
80 LightCyan,
81 LightGoldenRodYellow,
82 LightGray,
83 LightGrey,
84 LightGreen,
85 LightPink,
86 LightSalmon,
87 LightSeaGreen,
88 LightSkyBlue,
89 LightSlateGray,
90 LightSlateGrey,
91 LightSteelBlue,
92 LightYellow,
93 Lime,
94 LimeGreen,
95 Linen,
96 Magenta,
97 Maroon,
98 MediumAquaMarine,
99 MediumBlue,
100 MediumOrchid,
101 MediumPurple,
102 MediumSeaGreen,
103 MediumSlateBlue,
104 MediumSpringGreen,
105 MediumTurquoise,
106 MediumVioletRed,
107 MidnightBlue,
108 MintCream,
109 MistyRose,
110 Moccasin,
111 NavajoWhite,
112 Navy,
113 OldLace,
114 Olive,
115 OliveDrab,
116 Orange,
117 OrangeRed,
118 Orchid,
119 PaleGoldenRod,
120 PaleGreen,
121 PaleTurquoise,
122 PaleVioletRed,
123 PapayaWhip,
124 PeachPuff,
125 Peru,
126 Pink,
127 Plum,
128 PowderBlue,
129 Purple,
130 RebeccaPurple,
131 Red,
132 RosyBrown,
133 RoyalBlue,
134 SaddleBrown,
135 Salmon,
136 SandyBrown,
137 SeaGreen,
138 SeaShell,
139 Sienna,
140 Silver,
141 SkyBlue,
142 SlateBlue,
143 SlateGray,
144 SlateGrey,
145 Snow,
146 SpringGreen,
147 SteelBlue,
148 Tan,
149 Teal,
150 Thistle,
151 Tomato,
152 Turquoise,
153 Violet,
154 Wheat,
155 White,
156 WhiteSmoke,
157 Yellow,
158 YellowGreen,
159
160 Transparent,
162
163 Rgb(u8, u8, u8),
165
166 Rgba(u8, u8, u8, f32),
168
169 Hex(String),
171
172 Hsl(u16, u8, u8),
174
175 Hsla(u16, u8, u8, f32),
177
178 CurrentColor,
180
181 Inherit,
183
184 Var(crate::variable::CssVar),
186}
187
188impl fmt::Display for Color {
189 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
190 match self {
191 Color::AliceBlue => write!(f, "aliceblue"),
192 Color::AntiqueWhite => write!(f, "antiquewhite"),
193 Color::Aqua => write!(f, "aqua"),
194 Color::Aquamarine => write!(f, "aquamarine"),
195 Color::Azure => write!(f, "azure"),
196 Color::Beige => write!(f, "beige"),
197 Color::Bisque => write!(f, "bisque"),
198 Color::Black => write!(f, "black"),
199 Color::BlanchedAlmond => write!(f, "blanchedalmond"),
200 Color::Blue => write!(f, "blue"),
201 Color::BlueViolet => write!(f, "blueviolet"),
202 Color::Brown => write!(f, "brown"),
203 Color::BurlyWood => write!(f, "burlywood"),
204 Color::CadetBlue => write!(f, "cadetblue"),
205 Color::Chartreuse => write!(f, "chartreuse"),
206 Color::Chocolate => write!(f, "chocolate"),
207 Color::Coral => write!(f, "coral"),
208 Color::CornflowerBlue => write!(f, "cornflowerblue"),
209 Color::Cornsilk => write!(f, "cornsilk"),
210 Color::Crimson => write!(f, "crimson"),
211 Color::Cyan => write!(f, "cyan"),
212 Color::DarkBlue => write!(f, "darkblue"),
213 Color::DarkCyan => write!(f, "darkcyan"),
214 Color::DarkGoldenRod => write!(f, "darkgoldenrod"),
215 Color::DarkGray => write!(f, "darkgray"),
216 Color::DarkGrey => write!(f, "darkgrey"),
217 Color::DarkGreen => write!(f, "darkgreen"),
218 Color::DarkKhaki => write!(f, "darkkhaki"),
219 Color::DarkMagenta => write!(f, "darkmagenta"),
220 Color::DarkOliveGreen => write!(f, "darkolivegreen"),
221 Color::DarkOrange => write!(f, "darkorange"),
222 Color::DarkOrchid => write!(f, "darkorchid"),
223 Color::DarkRed => write!(f, "darkred"),
224 Color::DarkSalmon => write!(f, "darksalmon"),
225 Color::DarkSeaGreen => write!(f, "darkseagreen"),
226 Color::DarkSlateBlue => write!(f, "darkslateblue"),
227 Color::DarkSlateGray => write!(f, "darkslategray"),
228 Color::DarkSlateGrey => write!(f, "darkslategrey"),
229 Color::DarkTurquoise => write!(f, "darkturquoise"),
230 Color::DarkViolet => write!(f, "darkviolet"),
231 Color::DeepPink => write!(f, "deeppink"),
232 Color::DeepSkyBlue => write!(f, "deepskyblue"),
233 Color::DimGray => write!(f, "dimgray"),
234 Color::DimGrey => write!(f, "dimgrey"),
235 Color::DodgerBlue => write!(f, "dodgerblue"),
236 Color::FireBrick => write!(f, "firebrick"),
237 Color::FloralWhite => write!(f, "floralwhite"),
238 Color::ForestGreen => write!(f, "forestgreen"),
239 Color::Fuchsia => write!(f, "fuchsia"),
240 Color::Gainsboro => write!(f, "gainsboro"),
241 Color::GhostWhite => write!(f, "ghostwhite"),
242 Color::Gold => write!(f, "gold"),
243 Color::GoldenRod => write!(f, "goldenrod"),
244 Color::Gray => write!(f, "gray"),
245 Color::Grey => write!(f, "grey"),
246 Color::Green => write!(f, "green"),
247 Color::GreenYellow => write!(f, "greenyellow"),
248 Color::HoneyDew => write!(f, "honeydew"),
249 Color::HotPink => write!(f, "hotpink"),
250 Color::IndianRed => write!(f, "indianred"),
251 Color::Indigo => write!(f, "indigo"),
252 Color::Ivory => write!(f, "ivory"),
253 Color::Khaki => write!(f, "khaki"),
254 Color::Lavender => write!(f, "lavender"),
255 Color::LavenderBlush => write!(f, "lavenderblush"),
256 Color::LawnGreen => write!(f, "lawngreen"),
257 Color::LemonChiffon => write!(f, "lemonchiffon"),
258 Color::LightBlue => write!(f, "lightblue"),
259 Color::LightCoral => write!(f, "lightcoral"),
260 Color::LightCyan => write!(f, "lightcyan"),
261 Color::LightGoldenRodYellow => write!(f, "lightgoldenrodyellow"),
262 Color::LightGray => write!(f, "lightgray"),
263 Color::LightGrey => write!(f, "lightgrey"),
264 Color::LightGreen => write!(f, "lightgreen"),
265 Color::LightPink => write!(f, "lightpink"),
266 Color::LightSalmon => write!(f, "lightsalmon"),
267 Color::LightSeaGreen => write!(f, "lightseagreen"),
268 Color::LightSkyBlue => write!(f, "lightskyblue"),
269 Color::LightSlateGray => write!(f, "lightslategray"),
270 Color::LightSlateGrey => write!(f, "lightslategrey"),
271 Color::LightSteelBlue => write!(f, "lightsteelblue"),
272 Color::LightYellow => write!(f, "lightyellow"),
273 Color::Lime => write!(f, "lime"),
274 Color::LimeGreen => write!(f, "limegreen"),
275 Color::Linen => write!(f, "linen"),
276 Color::Magenta => write!(f, "magenta"),
277 Color::Maroon => write!(f, "maroon"),
278 Color::MediumAquaMarine => write!(f, "mediumaquamarine"),
279 Color::MediumBlue => write!(f, "mediumblue"),
280 Color::MediumOrchid => write!(f, "mediumorchid"),
281 Color::MediumPurple => write!(f, "mediumpurple"),
282 Color::MediumSeaGreen => write!(f, "mediumseagreen"),
283 Color::MediumSlateBlue => write!(f, "mediumslateblue"),
284 Color::MediumSpringGreen => write!(f, "mediumspringgreen"),
285 Color::MediumTurquoise => write!(f, "mediumturquoise"),
286 Color::MediumVioletRed => write!(f, "mediumvioletred"),
287 Color::MidnightBlue => write!(f, "midnightblue"),
288 Color::MintCream => write!(f, "mintcream"),
289 Color::MistyRose => write!(f, "mistyrose"),
290 Color::Moccasin => write!(f, "moccasin"),
291 Color::NavajoWhite => write!(f, "navajowhite"),
292 Color::Navy => write!(f, "navy"),
293 Color::OldLace => write!(f, "oldlace"),
294 Color::Olive => write!(f, "olive"),
295 Color::OliveDrab => write!(f, "olivedrab"),
296 Color::Orange => write!(f, "orange"),
297 Color::OrangeRed => write!(f, "orangered"),
298 Color::Orchid => write!(f, "orchid"),
299 Color::PaleGoldenRod => write!(f, "palegoldenrod"),
300 Color::PaleGreen => write!(f, "palegreen"),
301 Color::PaleTurquoise => write!(f, "paleturquoise"),
302 Color::PaleVioletRed => write!(f, "palevioletred"),
303 Color::PapayaWhip => write!(f, "papayawhip"),
304 Color::PeachPuff => write!(f, "peachpuff"),
305 Color::Peru => write!(f, "peru"),
306 Color::Pink => write!(f, "pink"),
307 Color::Plum => write!(f, "plum"),
308 Color::PowderBlue => write!(f, "powderblue"),
309 Color::Purple => write!(f, "purple"),
310 Color::RebeccaPurple => write!(f, "rebeccapurple"),
311 Color::Red => write!(f, "red"),
312 Color::RosyBrown => write!(f, "rosybrown"),
313 Color::RoyalBlue => write!(f, "royalblue"),
314 Color::SaddleBrown => write!(f, "saddlebrown"),
315 Color::Salmon => write!(f, "salmon"),
316 Color::SandyBrown => write!(f, "sandybrown"),
317 Color::SeaGreen => write!(f, "seagreen"),
318 Color::SeaShell => write!(f, "seashell"),
319 Color::Sienna => write!(f, "sienna"),
320 Color::Silver => write!(f, "silver"),
321 Color::SkyBlue => write!(f, "skyblue"),
322 Color::SlateBlue => write!(f, "slateblue"),
323 Color::SlateGray => write!(f, "slategray"),
324 Color::SlateGrey => write!(f, "slategrey"),
325 Color::Snow => write!(f, "snow"),
326 Color::SpringGreen => write!(f, "springgreen"),
327 Color::SteelBlue => write!(f, "steelblue"),
328 Color::Tan => write!(f, "tan"),
329 Color::Teal => write!(f, "teal"),
330 Color::Thistle => write!(f, "thistle"),
331 Color::Tomato => write!(f, "tomato"),
332 Color::Turquoise => write!(f, "turquoise"),
333 Color::Violet => write!(f, "violet"),
334 Color::Wheat => write!(f, "wheat"),
335 Color::White => write!(f, "white"),
336 Color::WhiteSmoke => write!(f, "whitesmoke"),
337 Color::Yellow => write!(f, "yellow"),
338 Color::YellowGreen => write!(f, "yellowgreen"),
339 Color::Transparent => write!(f, "transparent"),
340 Color::Rgb(r, g, b) => write!(f, "rgb({}, {}, {})", r, g, b),
341 Color::Rgba(r, g, b, a) => write!(f, "rgba({}, {}, {}, {})", r, g, b, a),
342 Color::Hex(hex) => {
343 let hex_str = if hex.starts_with('#') { hex.clone() } else { format!("#{}", hex) };
344 write!(f, "{}", hex_str)
345 },
346 Color::Hsl(h, s, l) => write!(f, "hsl({}, {}%, {}%)", h, s, l),
347 Color::Hsla(h, s, l, a) => write!(f, "hsla({}, {}%, {}%, {})", h, s, l, a),
348 Color::CurrentColor => write!(f, "currentColor"),
349 Color::Inherit => write!(f, "inherit"),
350 Color::Var(var) => write!(f, "{}", var),
351 }
352 }
353}
354
355#[derive(Debug, Clone, PartialEq)]
357pub enum Size {
358 Zero,
360
361 Px(u32),
363 Percent(f32),
365 Em(f32),
367 Rem(f32),
369 Vw(f32),
371 Vh(f32),
373 Auto,
375 Var(crate::variable::CssVar),
377}
378
379impl fmt::Display for Size {
380 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
381 match self {
382 Size::Zero => write!(f, "0"),
383 Size::Px(val) => write!(f, "{}px", val),
384 Size::Percent(val) => write!(f, "{}%", val),
385 Size::Em(val) => write!(f, "{}em", val),
386 Size::Rem(val) => write!(f, "{}rem", val),
387 Size::Vw(val) => write!(f, "{}vw", val),
388 Size::Vh(val) => write!(f, "{}vh", val),
389 Size::Auto => write!(f, "auto"),
390 Size::Var(var) => write!(f, "{}", var),
391 }
392 }
393}
394
395#[derive(Debug, Clone, PartialEq)]
397pub enum Display {
398 None,
399 Block,
400 Inline,
401 InlineBlock,
402 Flex,
403 Grid,
404 Table,
405 Var(crate::variable::CssVar),
407}
408
409impl fmt::Display for Display {
410 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
411 match self {
412 Display::None => write!(f, "none"),
413 Display::Block => write!(f, "block"),
414 Display::Inline => write!(f, "inline"),
415 Display::InlineBlock => write!(f, "inline-block"),
416 Display::Flex => write!(f, "flex"),
417 Display::Grid => write!(f, "grid"),
418 Display::Table => write!(f, "table"),
419 Display::Var(var) => write!(f, "{}", var),
420 }
421 }
422}
423
424#[derive(Debug, Clone, PartialEq)]
426pub enum Position {
427 Static,
428 Relative,
429 Absolute,
430 Fixed,
431 Sticky,
432 Var(crate::variable::CssVar),
434}
435
436impl fmt::Display for Position {
437 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
438 match self {
439 Position::Static => write!(f, "static"),
440 Position::Relative => write!(f, "relative"),
441 Position::Absolute => write!(f, "absolute"),
442 Position::Fixed => write!(f, "fixed"),
443 Position::Sticky => write!(f, "sticky"),
444 Position::Var(var) => write!(f, "{}", var),
445 }
446 }
447}
448
449#[derive(Debug, Clone, PartialEq)]
451pub enum FlexDirection {
452 Row,
453 RowReverse,
454 Column,
455 ColumnReverse,
456 Var(crate::variable::CssVar),
458}
459
460impl fmt::Display for FlexDirection {
461 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
462 match self {
463 FlexDirection::Row => write!(f, "row"),
464 FlexDirection::RowReverse => write!(f, "row-reverse"),
465 FlexDirection::Column => write!(f, "column"),
466 FlexDirection::ColumnReverse => write!(f, "column-reverse"),
467 FlexDirection::Var(var) => write!(f, "{}", var),
468 }
469 }
470}
471
472#[derive(Debug, Clone, PartialEq)]
474pub enum JustifyContent {
475 FlexStart,
476 FlexEnd,
477 Center,
478 SpaceBetween,
479 SpaceAround,
480 SpaceEvenly,
481 Var(crate::variable::CssVar),
483}
484
485impl fmt::Display for JustifyContent {
486 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
487 match self {
488 JustifyContent::FlexStart => write!(f, "flex-start"),
489 JustifyContent::FlexEnd => write!(f, "flex-end"),
490 JustifyContent::Center => write!(f, "center"),
491 JustifyContent::SpaceBetween => write!(f, "space-between"),
492 JustifyContent::SpaceAround => write!(f, "space-around"),
493 JustifyContent::SpaceEvenly => write!(f, "space-evenly"),
494 JustifyContent::Var(var) => write!(f, "{}", var),
495 }
496 }
497}
498
499#[derive(Debug, Clone, PartialEq)]
501pub enum AlignItems {
502 FlexStart,
503 FlexEnd,
504 Center,
505 Baseline,
506 Stretch,
507 Var(crate::variable::CssVar),
509}
510
511impl fmt::Display for AlignItems {
512 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
513 match self {
514 AlignItems::FlexStart => write!(f, "flex-start"),
515 AlignItems::FlexEnd => write!(f, "flex-end"),
516 AlignItems::Center => write!(f, "center"),
517 AlignItems::Baseline => write!(f, "baseline"),
518 AlignItems::Stretch => write!(f, "stretch"),
519 AlignItems::Var(var) => write!(f, "{}", var),
520 }
521 }
522}
523
524#[derive(Debug, Clone, PartialEq)]
526pub enum FontWeight {
527 Normal,
528 Bold,
529 Bolder,
530 Lighter,
531 Weight(u16),
533 Var(crate::variable::CssVar),
535}
536
537impl fmt::Display for FontWeight {
538 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
539 match self {
540 FontWeight::Normal => write!(f, "normal"),
541 FontWeight::Bold => write!(f, "bold"),
542 FontWeight::Bolder => write!(f, "bolder"),
543 FontWeight::Lighter => write!(f, "lighter"),
544 FontWeight::Weight(w) => {
545 if *w >= 100 && *w <= 900 && w % 100 == 0 {
547 write!(f, "{}", w)
548 } else {
549 write!(f, "400") }
551 },
552 FontWeight::Var(var) => write!(f, "{}", var),
553 }
554 }
555}
556
557#[derive(Debug, Clone, PartialEq)]
559pub enum TextAlign {
560 Left,
561 Right,
562 Center,
563 Justify,
564 Start,
565 End,
566 Var(crate::variable::CssVar),
568}
569
570impl fmt::Display for TextAlign {
571 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
572 match self {
573 TextAlign::Left => write!(f, "left"),
574 TextAlign::Right => write!(f, "right"),
575 TextAlign::Center => write!(f, "center"),
576 TextAlign::Justify => write!(f, "justify"),
577 TextAlign::Start => write!(f, "start"),
578 TextAlign::End => write!(f, "end"),
579 TextAlign::Var(var) => write!(f, "{}", var),
580 }
581 }
582}
583
584#[derive(Debug, Clone, PartialEq)]
586pub enum TextDecoration {
587 None,
588 Underline,
589 Overline,
590 LineThrough,
591 Var(crate::variable::CssVar),
593}
594
595impl fmt::Display for TextDecoration {
596 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
597 match self {
598 TextDecoration::None => write!(f, "none"),
599 TextDecoration::Underline => write!(f, "underline"),
600 TextDecoration::Overline => write!(f, "overline"),
601 TextDecoration::LineThrough => write!(f, "line-through"),
602 TextDecoration::Var(var) => write!(f, "{}", var),
603 }
604 }
605}
606
607#[derive(Debug, Clone, PartialEq)]
609pub enum Overflow {
610 Visible,
611 Hidden,
612 Scroll,
613 Auto,
614 Clip,
615 Var(crate::variable::CssVar),
617}
618
619impl fmt::Display for Overflow {
620 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
621 match self {
622 Overflow::Visible => write!(f, "visible"),
623 Overflow::Hidden => write!(f, "hidden"),
624 Overflow::Scroll => write!(f, "scroll"),
625 Overflow::Auto => write!(f, "auto"),
626 Overflow::Clip => write!(f, "clip"),
627 Overflow::Var(var) => write!(f, "{}", var),
628 }
629 }
630}
631
632#[derive(Debug, Clone, PartialEq)]
634pub enum Cursor {
635 Default,
636 Pointer,
637 Text,
638 NotAllowed,
639 Wait,
640 Move,
641 Grab,
642 ZoomIn,
643 ZoomOut,
644 Var(crate::variable::CssVar),
646}
647
648impl fmt::Display for Cursor {
649 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
650 match self {
651 Cursor::Default => write!(f, "default"),
652 Cursor::Pointer => write!(f, "pointer"),
653 Cursor::Text => write!(f, "text"),
654 Cursor::NotAllowed => write!(f, "not-allowed"),
655 Cursor::Wait => write!(f, "wait"),
656 Cursor::Move => write!(f, "move"),
657 Cursor::Grab => write!(f, "grab"),
658 Cursor::ZoomIn => write!(f, "zoom-in"),
659 Cursor::ZoomOut => write!(f, "zoom-out"),
660 Cursor::Var(var) => write!(f, "{}", var),
661 }
662 }
663}
664
665#[derive(Debug, Clone, PartialEq)]
667pub enum Visibility {
668 Visible,
669 Hidden,
670 Collapse,
671 Var(crate::variable::CssVar),
673}
674
675impl fmt::Display for Visibility {
676 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
677 match self {
678 Visibility::Visible => write!(f, "visible"),
679 Visibility::Hidden => write!(f, "hidden"),
680 Visibility::Collapse => write!(f, "collapse"),
681 Visibility::Var(var) => write!(f, "{}", var),
682 }
683 }
684}
685
686#[derive(Debug, Clone, PartialEq)]
688pub enum BorderStyle {
689 None,
690 Solid,
691 Dashed,
692 Dotted,
693 Double,
694 Groove,
695 Ridge,
696 Inset,
697 Outset,
698 Var(crate::variable::CssVar),
700}
701
702impl fmt::Display for BorderStyle {
703 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
704 match self {
705 BorderStyle::None => write!(f, "none"),
706 BorderStyle::Solid => write!(f, "solid"),
707 BorderStyle::Dashed => write!(f, "dashed"),
708 BorderStyle::Dotted => write!(f, "dotted"),
709 BorderStyle::Double => write!(f, "double"),
710 BorderStyle::Groove => write!(f, "groove"),
711 BorderStyle::Ridge => write!(f, "ridge"),
712 BorderStyle::Inset => write!(f, "inset"),
713 BorderStyle::Outset => write!(f, "outset"),
714 BorderStyle::Var(var) => write!(f, "{}", var),
715 }
716 }
717}
718
719#[derive(Debug, Clone, PartialEq)]
721pub enum FontSize {
722 Px(u32),
724 Percent(f32),
726 Em(f32),
728 Rem(f32),
730 Smaller,
732 Larger,
734 XxSmall,
736 XSmall,
737 Small,
738 Medium,
739 Large,
740 XLarge,
741 XxLarge,
742 Calc(String),
744 Var(crate::variable::CssVar),
746}
747
748impl fmt::Display for FontSize {
749 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
750 match self {
751 FontSize::Px(val) => write!(f, "{}px", val),
752 FontSize::Percent(val) => write!(f, "{}%", val),
753 FontSize::Em(val) => write!(f, "{}em", val),
754 FontSize::Rem(val) => write!(f, "{}rem", val),
755 FontSize::Smaller => write!(f, "smaller"),
756 FontSize::Larger => write!(f, "larger"),
757 FontSize::XxSmall => write!(f, "xx-small"),
758 FontSize::XSmall => write!(f, "x-small"),
759 FontSize::Small => write!(f, "small"),
760 FontSize::Medium => write!(f, "medium"),
761 FontSize::Large => write!(f, "large"),
762 FontSize::XLarge => write!(f, "x-large"),
763 FontSize::XxLarge => write!(f, "xx-large"),
764 FontSize::Calc(expr) => write!(f, "calc({})", expr),
765 FontSize::Var(var) => write!(f, "{}", var),
766 }
767 }
768}
769
770#[derive(Debug, Clone, PartialEq)]
772pub enum LineHeight {
773 Normal,
775 Number(f32),
777 Length(Size),
779 Percent(f32),
781 Calc(String),
783 Var(crate::variable::CssVar),
785}
786
787impl fmt::Display for LineHeight {
788 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
789 match self {
790 LineHeight::Normal => write!(f, "normal"),
791 LineHeight::Number(val) => write!(f, "{}", val),
792 LineHeight::Length(size) => write!(f, "{}", size),
793 LineHeight::Percent(val) => write!(f, "{}%", val),
794 LineHeight::Calc(expr) => write!(f, "calc({})", expr),
795 LineHeight::Var(var) => write!(f, "{}", var),
796 }
797 }
798}
799
800#[derive(Debug, Clone, PartialEq)]
802pub struct BoxShadow {
803 pub h_offset: Size,
804 pub v_offset: Size,
805 pub blur: Option<Size>,
806 pub spread: Option<Size>,
807 pub color: Option<Color>,
808 pub inset: bool,
809}
810
811impl fmt::Display for BoxShadow {
812 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
813 if self.inset {
814 write!(f, "inset ")?;
815 }
816
817 write!(f, "{} {}", self.h_offset, self.v_offset)?;
818
819 if let Some(blur) = &self.blur {
820 write!(f, " {}", blur)?;
821 }
822
823 if let Some(spread) = &self.spread {
824 write!(f, " {}", spread)?;
825 }
826
827 if let Some(color) = &self.color {
828 write!(f, " {}", color)?;
829 }
830
831 Ok(())
832 }
833}
834
835#[derive(Debug, Clone, PartialEq)]
837pub struct Transition {
838 pub property: String,
839 pub duration: f32,
840 pub timing_function: Option<String>,
841 pub delay: Option<f32>,
842}
843
844impl fmt::Display for Transition {
845 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
846 write!(f, "{} {}s", self.property, self.duration)?;
847
848 if let Some(timing) = &self.timing_function {
849 write!(f, " {}", timing)?;
850 }
851
852 if let Some(delay) = self.delay {
853 write!(f, " {}s", delay)?;
854 }
855
856 Ok(())
857 }
858}
859
860#[derive(Debug, Clone, PartialEq)]
862pub enum ZIndex {
863 Auto,
864 Index(i32),
865 Var(crate::variable::CssVar),
867}
868
869impl fmt::Display for ZIndex {
870 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
871 match self {
872 ZIndex::Auto => write!(f, "auto"),
873 ZIndex::Index(val) => write!(f, "{}", val),
874 ZIndex::Var(var) => write!(f, "{}", var),
875 }
876 }
877}
878
879impl From<crate::variable::CssVar> for Color {
881 fn from(var: crate::variable::CssVar) -> Self {
882 Color::Var(var)
883 }
884}
885
886impl From<crate::variable::CssVar> for Size {
888 fn from(var: crate::variable::CssVar) -> Self {
889 Size::Var(var)
890 }
891}
892
893impl From<crate::variable::CssVar> for Display {
895 fn from(var: crate::variable::CssVar) -> Self {
896 Display::Var(var)
897 }
898}
899
900impl From<crate::variable::CssVar> for Position {
902 fn from(var: crate::variable::CssVar) -> Self {
903 Position::Var(var)
904 }
905}
906
907impl From<crate::variable::CssVar> for FlexDirection {
909 fn from(var: crate::variable::CssVar) -> Self {
910 FlexDirection::Var(var)
911 }
912}
913
914impl From<crate::variable::CssVar> for JustifyContent {
916 fn from(var: crate::variable::CssVar) -> Self {
917 JustifyContent::Var(var)
918 }
919}
920
921impl From<crate::variable::CssVar> for AlignItems {
923 fn from(var: crate::variable::CssVar) -> Self {
924 AlignItems::Var(var)
925 }
926}
927
928impl From<crate::variable::CssVar> for FontWeight {
930 fn from(var: crate::variable::CssVar) -> Self {
931 FontWeight::Var(var)
932 }
933}
934
935impl From<crate::variable::CssVar> for TextAlign {
937 fn from(var: crate::variable::CssVar) -> Self {
938 TextAlign::Var(var)
939 }
940}
941
942impl From<crate::variable::CssVar> for TextDecoration {
944 fn from(var: crate::variable::CssVar) -> Self {
945 TextDecoration::Var(var)
946 }
947}
948
949impl From<crate::variable::CssVar> for Overflow {
951 fn from(var: crate::variable::CssVar) -> Self {
952 Overflow::Var(var)
953 }
954}
955
956impl From<crate::variable::CssVar> for Cursor {
958 fn from(var: crate::variable::CssVar) -> Self {
959 Cursor::Var(var)
960 }
961}
962
963impl From<crate::variable::CssVar> for Visibility {
965 fn from(var: crate::variable::CssVar) -> Self {
966 Visibility::Var(var)
967 }
968}
969
970impl From<crate::variable::CssVar> for BorderStyle {
972 fn from(var: crate::variable::CssVar) -> Self {
973 BorderStyle::Var(var)
974 }
975}
976
977impl From<crate::variable::CssVar> for ZIndex {
979 fn from(var: crate::variable::CssVar) -> Self {
980 ZIndex::Var(var)
981 }
982}
983
984impl From<crate::variable::CssVar> for FontSize {
986 fn from(var: crate::variable::CssVar) -> Self {
987 FontSize::Var(var)
988 }
989}
990
991impl From<crate::variable::CssVar> for LineHeight {
993 fn from(var: crate::variable::CssVar) -> Self {
994 LineHeight::Var(var)
995 }
996}