Skip to main content

material_ui_rs/design/style/
pane_grid.rs

1use iced_widget::core::{Background, border};
2use iced_widget::pane_grid::{Catalog, Highlight, Line, Style, StyleFn};
3
4use crate::Theme;
5use crate::utils::{HOVERED_LAYER_OPACITY, mix};
6
7impl Catalog for Theme {
8    type Class<'a> = StyleFn<'a, Self>;
9
10    fn default<'a>() -> <Self as Catalog>::Class<'a> {
11        Box::new(default)
12    }
13
14    fn style(&self, class: &<Self as Catalog>::Class<'_>) -> Style {
15        class(self)
16    }
17}
18
19pub fn default(theme: &Theme) -> Style {
20    Style {
21        hovered_region: Highlight {
22            background: Background::Color(mix(
23                theme.colors().tertiary.container,
24                theme.colors().surface.text,
25                HOVERED_LAYER_OPACITY,
26            )),
27            border: border::rounded(12),
28        },
29        picked_split: Line {
30            color: theme.colors().outline.variant,
31            width: 2.0,
32        },
33        hovered_split: Line {
34            color: theme.colors().surface.text,
35            width: 6.0,
36        },
37    }
38}