ratatui_toolkit/primitives/pane/methods/
with_theme.rs

1//! Method to apply an AppTheme to the Pane.
2
3use crate::primitives::pane::Pane;
4use crate::services::theme::AppTheme;
5use ratatui::style::Style;
6
7impl<'a> Pane<'a> {
8    /// Applies theme colors to the pane.
9    ///
10    /// This method configures the pane's border and footer styles
11    /// based on the provided theme.
12    ///
13    /// # Theme Mapping
14    ///
15    /// - Border style uses `theme.border`
16    /// - Footer style uses `theme.text_muted`
17    ///
18    /// # Arguments
19    ///
20    /// * `theme` - The application theme to apply
21    ///
22    /// # Returns
23    ///
24    /// Self with theme colors applied for method chaining.
25    ///
26    /// # Example
27    ///
28    /// ```rust,no_run
29    /// use ratatui_toolkit::{Pane, AppTheme};
30    ///
31    /// let theme = AppTheme::default();
32    /// let pane = Pane::new("My Panel")
33    ///     .with_theme(&theme);
34    /// ```
35    pub fn with_theme(mut self, theme: &AppTheme) -> Self {
36        self.border_style = Style::default().fg(theme.border);
37        self.footer_style = Style::default().fg(theme.text_muted);
38        self
39    }
40}