aboutsummaryrefslogtreecommitdiff
path: root/src/pane_grid.rs
blob: c89536ea57548259ddf33645e4ff04f8fb20a3d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use iced_widget::core::{Background, border};
use iced_widget::pane_grid::{Catalog, Highlight, Line, Style, StyleFn};

use super::Theme;
use crate::utils::{HOVERED_LAYER_OPACITY, mix};

impl Catalog for Theme {
    type Class<'a> = StyleFn<'a, Self>;

    fn default<'a>() -> <Self as Catalog>::Class<'a> {
        Box::new(default)
    }

    fn style(&self, class: &<Self as Catalog>::Class<'_>) -> Style {
        class(self)
    }
}

pub fn default(theme: &Theme) -> Style {
    Style {
        hovered_region: Highlight {
            background: Background::Color(mix(
                theme.colors().tertiary.container,
                theme.colors().surface.text,
                HOVERED_LAYER_OPACITY,
            )),
            border: border::rounded(12),
        },
        picked_split: Line {
            color: theme.colors().outline.variant,
            width: 2.0,
        },
        hovered_split: Line {
            color: theme.colors().surface.text,
            width: 6.0,
        },
    }
}