Skip to main content

uzor_core/widgets/panel/
theme.rs

1//! Panel theme trait - Contract/Connector for panel colors and dimensions
2
3/// Theme trait for panel colors and dimensions
4pub trait PanelTheme {
5    // Toolbar dimensions
6    fn toolbar_height(&self) -> f64;
7    fn toolbar_width(&self) -> f64;
8    fn toolbar_blur(&self) -> bool;
9
10    // Sidebar dimensions
11    fn sidebar_width(&self) -> f64;
12    fn sidebar_header_height(&self) -> f64;
13    fn sidebar_item_height(&self) -> f64;
14    fn sidebar_section_height(&self) -> f64;
15    fn sidebar_logo_size(&self) -> f64;
16
17    // Modal dimensions
18    fn modal_max_width(&self) -> f64;
19    fn modal_padding(&self) -> f64;
20    fn modal_backdrop_color(&self) -> [u8; 4];
21    fn modal_header_height(&self) -> f64;
22    fn modal_tab_height(&self) -> f64;
23    fn modal_content_row_height(&self) -> f64;
24    fn modal_content_padding(&self) -> f64;
25
26    // Hideable dimensions
27    fn hideable_chevron_size(&self) -> f64;
28    fn hideable_button_height(&self) -> f64;
29    fn hideable_row_height(&self) -> f64;
30    fn hideable_row_gap(&self) -> f64;
31    fn hideable_icon_size(&self) -> f64;
32    fn hideable_border_width(&self) -> f64;
33    fn hideable_border_opacity(&self) -> f64;
34    fn hideable_button_padding(&self) -> f64;
35
36    // Common colors
37    fn background_color(&self) -> [u8; 4];
38    fn border_color(&self) -> [u8; 4];
39    fn text_color(&self) -> [u8; 4];
40    fn text_secondary_color(&self) -> [u8; 4];
41    fn hover_color(&self) -> [u8; 4];
42}
43
44/// Default panel theme using values from inline specs
45pub struct DefaultPanelTheme;
46
47impl DefaultPanelTheme {
48    pub fn new() -> Self {
49        Self
50    }
51}
52
53impl Default for DefaultPanelTheme {
54    fn default() -> Self {
55        Self::new()
56    }
57}
58
59impl PanelTheme for DefaultPanelTheme {
60    fn toolbar_height(&self) -> f64 { 40.0 }
61    fn toolbar_width(&self) -> f64 { 40.0 }
62    fn toolbar_blur(&self) -> bool { true }
63
64    fn sidebar_width(&self) -> f64 { 250.0 }
65    fn sidebar_header_height(&self) -> f64 { 56.0 }
66    fn sidebar_item_height(&self) -> f64 { 40.0 }
67    fn sidebar_section_height(&self) -> f64 { 32.0 }
68    fn sidebar_logo_size(&self) -> f64 { 40.0 }
69
70    fn modal_max_width(&self) -> f64 { 600.0 }
71    fn modal_padding(&self) -> f64 { 24.0 }
72    fn modal_backdrop_color(&self) -> [u8; 4] { [0, 0, 0, 128] }
73    fn modal_header_height(&self) -> f64 { 36.0 }
74    fn modal_tab_height(&self) -> f64 { 32.0 }
75    fn modal_content_row_height(&self) -> f64 { 28.0 }
76    fn modal_content_padding(&self) -> f64 { 12.0 }
77
78    fn hideable_chevron_size(&self) -> f64 { 12.0 }
79    fn hideable_button_height(&self) -> f64 { 18.0 }
80    fn hideable_row_height(&self) -> f64 { 20.0 }
81    fn hideable_row_gap(&self) -> f64 { 2.0 }
82    fn hideable_icon_size(&self) -> f64 { 14.0 }
83    fn hideable_border_width(&self) -> f64 { 0.5 }
84    fn hideable_border_opacity(&self) -> f64 { 0.8 }
85    fn hideable_button_padding(&self) -> f64 { 6.0 }
86
87    fn background_color(&self) -> [u8; 4] { [30, 30, 30, 255] }
88    fn border_color(&self) -> [u8; 4] { [80, 80, 80, 255] }
89    fn text_color(&self) -> [u8; 4] { [255, 255, 255, 255] }
90    fn text_secondary_color(&self) -> [u8; 4] { [128, 128, 128, 255] }
91    fn hover_color(&self) -> [u8; 4] { [50, 50, 50, 255] }
92}