Skip to main content

uzor_core/widgets/slider/
theme.rs

1//! Slider theme trait - Contract/Connector for slider colors and dimensions
2
3/// Theme trait for slider colors and dimensions
4pub trait SliderTheme {
5    fn track_height(&self) -> f64;
6    fn handle_radius(&self) -> f64;
7    fn handle_border_width(&self) -> f64;
8    fn track_color(&self) -> [u8; 4];
9    fn handle_color(&self) -> [u8; 4];
10    fn handle_border_color(&self) -> [u8; 4];
11    fn active_handle_color(&self) -> [u8; 4];
12    fn hover_handle_color(&self) -> [u8; 4];
13}
14
15/// Default slider theme using prototype colors
16pub struct DefaultSliderTheme;
17
18impl DefaultSliderTheme {
19    pub fn new() -> Self {
20        Self
21    }
22}
23
24impl Default for DefaultSliderTheme {
25    fn default() -> Self {
26        Self::new()
27    }
28}
29
30impl SliderTheme for DefaultSliderTheme {
31    fn track_height(&self) -> f64 { 4.0 }
32    fn handle_radius(&self) -> f64 { 6.0 }
33    fn handle_border_width(&self) -> f64 { 2.0 }
34    fn track_color(&self) -> [u8; 4] { [80, 80, 80, 255] }
35    fn handle_color(&self) -> [u8; 4] { [255, 255, 255, 255] }
36    fn handle_border_color(&self) -> [u8; 4] { [100, 100, 100, 255] }
37    fn active_handle_color(&self) -> [u8; 4] { [0, 120, 215, 255] }
38    fn hover_handle_color(&self) -> [u8; 4] { [200, 200, 200, 255] }
39}