Tailwind classes in OCaml
1type font_family = Sans | Serif | Mono
2type font_size = Xs | Sm | Base | Lg | Xl | Xl2 | Xl3 | Xl4 | Xl5 | Xl6 | Xl7 | Xl8 | Xl9
3type font_weight = Thin | Extralight | Light | Normal | Medium | Semibold | Bold | Extrabold | Black
4type font_style = Italic | Not_italic
5type letter_spacing = Tighter | Tight | Normal | Wide | Wider | Widest
6type line_height = None | Tight | Snug | Normal | Relaxed | Loose | Rem of float
7type text_align = Left | Center | Right | Justify | Start | End
8type text_decoration = Underline | Overline | Line_through | No_underline
9type text_transform = Uppercase | Lowercase | Capitalize | Normal_case
10
11type t =
12 | Font_family of font_family
13 | Font_size of font_size
14 | Font_weight of font_weight
15 | Font_style of font_style
16 | Letter_spacing of letter_spacing
17 | Line_height of line_height
18 | Text_align of text_align
19 | Text_decoration of text_decoration
20 | Text_transform of text_transform
21 | Text_color of Color.t
22
23let to_class = function
24 | Font_family Sans -> Css.make "font-sans"
25 | Font_family Serif -> Css.make "font-serif"
26 | Font_family Mono -> Css.make "font-mono"
27 | Font_size Xs -> Css.make "text-xs"
28 | Font_size Sm -> Css.make "text-sm"
29 | Font_size Base -> Css.make "text-base"
30 | Font_size Lg -> Css.make "text-lg"
31 | Font_size Xl -> Css.make "text-xl"
32 | Font_size Xl2 -> Css.make "text-2xl"
33 | Font_size Xl3 -> Css.make "text-3xl"
34 | Font_size Xl4 -> Css.make "text-4xl"
35 | Font_size Xl5 -> Css.make "text-5xl"
36 | Font_size Xl6 -> Css.make "text-6xl"
37 | Font_size Xl7 -> Css.make "text-7xl"
38 | Font_size Xl8 -> Css.make "text-8xl"
39 | Font_size Xl9 -> Css.make "text-9xl"
40 | Font_weight Thin -> Css.make "font-thin"
41 | Font_weight Extralight -> Css.make "font-extralight"
42 | Font_weight Light -> Css.make "font-light"
43 | Font_weight Normal -> Css.make "font-normal"
44 | Font_weight Medium -> Css.make "font-medium"
45 | Font_weight Semibold -> Css.make "font-semibold"
46 | Font_weight Bold -> Css.make "font-bold"
47 | Font_weight Extrabold -> Css.make "font-extrabold"
48 | Font_weight Black -> Css.make "font-black"
49 | Font_style Italic -> Css.make "italic"
50 | Font_style Not_italic -> Css.make "not-italic"
51 | Letter_spacing Tighter -> Css.make "tracking-tighter"
52 | Letter_spacing Tight -> Css.make "tracking-tight"
53 | Letter_spacing Normal -> Css.make "tracking-normal"
54 | Letter_spacing Wide -> Css.make "tracking-wide"
55 | Letter_spacing Wider -> Css.make "tracking-wider"
56 | Letter_spacing Widest -> Css.make "tracking-widest"
57 | Line_height None -> Css.make "leading-none"
58 | Line_height Tight -> Css.make "leading-tight"
59 | Line_height Snug -> Css.make "leading-snug"
60 | Line_height Normal -> Css.make "leading-normal"
61 | Line_height Relaxed -> Css.make "leading-relaxed"
62 | Line_height Loose -> Css.make "leading-loose"
63 | Line_height (Rem f) -> Css.make (Printf.sprintf "leading-[%.1frem]" f)
64 | Text_align Left -> Css.make "text-left"
65 | Text_align Center -> Css.make "text-center"
66 | Text_align Right -> Css.make "text-right"
67 | Text_align Justify -> Css.make "text-justify"
68 | Text_align Start -> Css.make "text-start"
69 | Text_align End -> Css.make "text-end"
70 | Text_decoration Underline -> Css.make "underline"
71 | Text_decoration Overline -> Css.make "overline"
72 | Text_decoration Line_through -> Css.make "line-through"
73 | Text_decoration No_underline -> Css.make "no-underline"
74 | Text_transform Uppercase -> Css.make "uppercase"
75 | Text_transform Lowercase -> Css.make "lowercase"
76 | Text_transform Capitalize -> Css.make "capitalize"
77 | Text_transform Normal_case -> Css.make "normal-case"
78 | Text_color color -> Color.text color
79
80let font_family ff = Font_family ff
81let font_size fs = Font_size fs
82let font_weight fw = Font_weight fw
83let font_style fs = Font_style fs
84let letter_spacing ls = Letter_spacing ls
85let line_height lh = Line_height lh
86let text_align ta = Text_align ta
87let text_decoration td = Text_decoration td
88let text_transform tt = Text_transform tt
89let text_color c = Text_color c
90
91let text_xs = Css.make "text-xs"
92let text_sm = Css.make "text-sm"
93let text_base = Css.make "text-base"
94let text_lg = Css.make "text-lg"
95let text_xl = Css.make "text-xl"
96let font_bold = Css.make "font-bold"
97let font_normal = Css.make "font-normal"
98let italic = Css.make "italic"
99let underline = Css.make "underline"
100let uppercase = Css.make "uppercase"
101let lowercase = Css.make "lowercase"
102let capitalize = Css.make "capitalize"