cabin_tailwind/utilities/
outline.rs1use std::fmt;
6
7use crate::{Length, Property, Utility};
8
9const OUTLINE_STYLE: &str = "outline-style";
10const OUTLINE_WIDTH: &str = "outline-width";
11const OUTLINE_OFFSET: &str = "outline-offset";
12const OUTLINE_COLOR: &str = "outline-color";
13
14include!(concat!(env!("OUT_DIR"), "/outline-color.rs"));
15
16pub const NONE: OutlineNone = OutlineNone;
22
23pub const SOLID: Property = Property(OUTLINE_STYLE, "solid");
27
28pub const DASHED: Property = Property(OUTLINE_STYLE, "dashed");
32
33pub const DOTTED: Property = Property(OUTLINE_STYLE, "dotted");
37
38pub const DOUBLE: Property = Property(OUTLINE_STYLE, "double");
42
43pub fn offset(x: i16) -> Property<Length> {
47 Property(OUTLINE_OFFSET, Length::Px(f32::from(x)))
48}
49
50pub fn offsetf(x: f32) -> Property<Length> {
54 Property(OUTLINE_OFFSET, Length::Px(x))
55}
56
57pub fn width(x: i16) -> Property<Length> {
61 Property(OUTLINE_WIDTH, Length::Px(f32::from(x)))
62}
63
64pub fn widthf(x: f32) -> Property<Length> {
68 Property(OUTLINE_WIDTH, Length::Px(x))
69}
70
71pub struct OutlineNone;
72
73impl Utility for OutlineNone {
74 fn declarations(&self, f: &mut dyn fmt::Write) -> fmt::Result {
75 writeln!(f, "outline: 2px solid transparent;")?;
76 writeln!(f, "outline-offset: 2px;")?;
77 Ok(())
78 }
79}