1use crate::primitives::color::Color;
2
3#[derive(Debug, Clone, Copy)]
4pub enum SizingPolicy {
5 Auto, Fixed(u32), FillParent, }
9
10#[derive(Debug, Clone, Copy)]
11pub enum Align {
12 Start, Middle,
14 End, }
16
17#[derive(Default, Debug, Clone, Copy)]
18pub struct Insets {
19 pub top: u32,
20 pub right: u32,
21 pub bottom: u32,
22 pub left: u32,
23}
24
25#[derive(Clone, Copy, Debug)]
26pub struct Style {
27 pub padding: Insets,
28 pub margin: Insets,
29 pub width: SizingPolicy,
30 pub height: SizingPolicy,
31 pub align_x: Align, pub align_y: Align,
33 pub justify_x: Align, pub justify_y: Align,
35 pub background_color: Color,
36 pub border_color: Color,
37 pub border_radius: [f32; 4], pub border_width: f32, }
40
41impl Default for Style {
42 fn default() -> Self {
43 Self {
44 padding: Insets::default(),
45 margin: Insets::default(),
46 width: SizingPolicy::Auto,
47 height: SizingPolicy::Auto,
48 align_x: Align::Start,
49 align_y: Align::Start,
50 justify_x: Align::Start,
51 justify_y: Align::Start,
52 background_color: Color::default(),
53 border_color: Color::default(),
54 border_radius: [0.0, 0.0, 0.0, 0.0],
55 border_width: 0.0,
56 }
57 }
58}
59
60#[derive(Clone, Debug)]
61pub enum FontFamily {
62 Name(String),
63 Serif,
64 SansSerif,
65 Cursive,
66 Fantasy,
67 Monospace,
68}
69
70#[derive(Clone, Debug)]
71pub enum FontWeight {
72 Thin,
73 ExtraLight,
74 Light,
75 Normal,
76 Medium,
77 SemiBold,
78 Bold,
79 ExtraBold,
80 Black,
81}
82
83#[derive(Clone, Debug)]
84pub enum FontStyle {
85 Normal,
86 Italic,
87 Oblique,
88}
89
90#[derive(Clone, Debug)]
93pub struct TextStyle {
94 pub font_size: f32,
95 pub line_height: f32,
96 pub font_family: FontFamily,
97 pub font_weight: FontWeight,
98 pub font_style: FontStyle,
99 pub text_color: Color,
100}
101
102impl Default for TextStyle {
103 fn default() -> Self {
104 Self {
105 font_size: 16.0,
106 line_height: 20.0,
107 font_family: FontFamily::SansSerif,
108 font_weight: FontWeight::Normal,
109 font_style: FontStyle::Normal,
110 text_color: Color::default(),
111 }
112 }
113}