use fret_core::{Color, Px};
use crate::Theme;
#[derive(Debug, Clone)]
pub struct ResizablePanelGroupStyle {
pub gap: Px,
pub hit_thickness: Px,
pub paint_device_px: f32,
pub handle_color: Color,
pub handle_alpha: f32,
pub handle_hover_alpha: f32,
pub handle_drag_alpha: f32,
}
impl Default for ResizablePanelGroupStyle {
fn default() -> Self {
Self {
gap: Px(0.0),
hit_thickness: Px(6.0),
paint_device_px: 1.0,
handle_color: Color {
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0,
},
handle_alpha: 1.0,
handle_hover_alpha: 1.0,
handle_drag_alpha: 1.0,
}
}
}
impl ResizablePanelGroupStyle {
pub fn from_theme(theme: &Theme) -> Self {
let handle_color = theme
.color_by_key("border")
.or_else(|| theme.color_by_key("input"))
.unwrap_or(theme.snapshot().colors.panel_border);
Self {
gap: Px(0.0),
hit_thickness: Px(6.0),
paint_device_px: 1.0,
handle_color,
..Default::default()
}
}
}