cabin_tailwind/utilities/
to.rs1use std::fmt;
4
5use crate::{Length, Property, Utility};
6
7pub struct ToColor(pub(crate) &'static str);
8
9include!(concat!(env!("OUT_DIR"), "/to-color.rs"));
10
11pub fn percent(x: i16) -> Property<Length> {
15 Property("--tw-gradient-to-position", Length::Percent(f32::from(x)))
16}
17
18pub fn percentf(x: f32) -> Property<Length> {
22 Property("--tw-gradient-to-position", Length::Percent(x))
23}
24
25impl Utility for ToColor {
26 fn declarations(&self, f: &mut dyn fmt::Write) -> fmt::Result {
27 writeln!(
29 f,
30 "--tw-gradient-to: {}FF var(--tw-gradient-to-position);",
31 self.0
32 )?;
33 Ok(())
34 }
35
36 fn order(&self) -> usize {
37 1
39 }
40}