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