bevy_ui_builders/panel/
types.rs

1//! Panel component types and markers
2
3use bevy::prelude::*;
4
5/// Component for panels/containers
6#[derive(Component, Debug)]
7pub struct Panel {
8    pub style: PanelStyle,
9}
10
11/// Panel style variants
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
13pub enum PanelStyle {
14    #[default]
15    Default,     // Standard panel
16    Elevated,    // With shadow/depth
17    Transparent, // No background
18    Dark,        // Dark background
19    Light,       // Light background
20    Bordered,    // With visible border
21    FullScreen,  // Full screen overlay panel
22    Card,        // Card-style panel with subtle background
23}
24
25impl PanelStyle {
26    pub fn background_color(&self) -> Color {
27        match self {
28            PanelStyle::Default => crate::colors::BACKGROUND_MEDIUM,
29            PanelStyle::Elevated => crate::colors::BACKGROUND_LIGHT,
30            PanelStyle::Transparent => Color::NONE,
31            PanelStyle::Dark => crate::colors::BACKGROUND_DARK,
32            PanelStyle::Light => crate::colors::BACKGROUND_LIGHT,
33            PanelStyle::Bordered => crate::colors::BACKGROUND_MEDIUM,
34            PanelStyle::FullScreen => Color::srgba(0.0, 0.0, 0.0, 0.8), // Semi-transparent overlay
35            PanelStyle::Card => crate::colors::BACKGROUND_LIGHT,
36        }
37    }
38
39    pub fn border_color(&self) -> Color {
40        match self {
41            PanelStyle::Bordered => crate::colors::BORDER_DEFAULT,
42            PanelStyle::Card => Color::srgba(0.2, 0.2, 0.2, 0.3), // Subtle border for cards
43            _ => Color::NONE,
44        }
45    }
46
47    pub fn border_width(&self) -> Val {
48        match self {
49            PanelStyle::Bordered => Val::Px(crate::dimensions::BORDER_WIDTH),
50            PanelStyle::Card => Val::Px(1.0), // Thin border for cards
51            _ => Val::Px(0.0),
52        }
53    }
54}