1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub struct Style {
6 pub bg_color: crate::widget::Color,
8 pub border_color: crate::widget::Color,
10 pub border_width: u8,
12}
13
14impl Default for Style {
15 fn default() -> Self {
16 Self {
17 bg_color: crate::widget::Color(255, 255, 255, 255),
18 border_color: crate::widget::Color(0, 0, 0, 255),
19 border_width: 0,
20 }
21 }
22}
23
24pub struct StyleBuilder {
26 style: Style,
27}
28
29impl Default for StyleBuilder {
30 fn default() -> Self {
31 Self::new()
32 }
33}
34
35impl StyleBuilder {
36 pub fn new() -> Self {
38 Self {
39 style: Style::default(),
40 }
41 }
42
43 pub fn bg_color(mut self, color: crate::widget::Color) -> Self {
45 self.style.bg_color = color;
46 self
47 }
48
49 pub fn border_color(mut self, color: crate::widget::Color) -> Self {
51 self.style.border_color = color;
52 self
53 }
54
55 pub fn border_width(mut self, width: u8) -> Self {
57 self.style.border_width = width;
58 self
59 }
60
61 pub fn build(self) -> Style {
63 self.style
64 }
65}