pub struct ThemeManager { /* private fields */ }Expand description
Theme manager for runtime theme management and switching
Implementations§
Source§impl ThemeManager
impl ThemeManager
Sourcepub fn with_theme(theme: Theme) -> Self
pub fn with_theme(theme: Theme) -> Self
Create a theme manager with a specific theme
Sourcepub fn with_registry(registry: ThemeRegistry) -> Self
pub fn with_registry(registry: ThemeRegistry) -> Self
Create a theme manager with a custom registry
Sourcepub fn switch_by_name(&self, name: &str) -> Result<()>
pub fn switch_by_name(&self, name: &str) -> Result<()>
Switch to a theme by name
Sourcepub fn available_themes(&self) -> Vec<&'static str>
pub fn available_themes(&self) -> Vec<&'static str>
Get all available theme names
Sourcepub fn current_name(&self) -> Result<String>
pub fn current_name(&self) -> Result<String>
Get the current theme name
Sourcepub fn load_from_config(&self, config: &TuiConfig) -> Result<()>
pub fn load_from_config(&self, config: &TuiConfig) -> Result<()>
Load theme from config
Sourcepub fn save_to_config(&self, config: &mut TuiConfig) -> Result<()>
pub fn save_to_config(&self, config: &mut TuiConfig) -> Result<()>
Save current theme to config
Sourcepub fn load_from_storage(&self) -> Result<()>
pub fn load_from_storage(&self) -> Result<()>
Load theme preference from storage
Sourcepub fn save_to_storage(&self) -> Result<()>
pub fn save_to_storage(&self) -> Result<()>
Save current theme preference to storage
Sourcepub fn load_custom_theme(&self, path: &Path) -> Result<()>
pub fn load_custom_theme(&self, path: &Path) -> Result<()>
Load a custom theme from a file
Sourcepub fn load_custom_themes_from_directory(
&self,
dir: &Path,
) -> Result<Vec<Theme>>
pub fn load_custom_themes_from_directory( &self, dir: &Path, ) -> Result<Vec<Theme>>
Load all custom themes from a directory
Sourcepub fn load_and_register_custom_themes(&self, dir: &Path) -> Result<Vec<String>>
pub fn load_and_register_custom_themes(&self, dir: &Path) -> Result<Vec<String>>
Load all custom themes from a directory and register them
Sourcepub fn load_custom_themes_from_storage(&self) -> Result<Vec<String>>
pub fn load_custom_themes_from_storage(&self) -> Result<Vec<String>>
Load all custom themes from storage and register them
Sourcepub fn save_custom_theme(&self, path: &Path) -> Result<()>
pub fn save_custom_theme(&self, path: &Path) -> Result<()>
Save current theme as a custom theme to storage
Sourcepub fn save_custom_theme_to_storage(&self, theme_name: &str) -> Result<()>
pub fn save_custom_theme_to_storage(&self, theme_name: &str) -> Result<()>
Save current theme as a custom theme to storage by name
Sourcepub fn save_theme_as_custom(&self, theme: &Theme, path: &Path) -> Result<()>
pub fn save_theme_as_custom(&self, theme: &Theme, path: &Path) -> Result<()>
Save a specific theme as a custom theme
Sourcepub fn save_theme_as_custom_to_storage(
&self,
theme: &Theme,
theme_name: &str,
) -> Result<()>
pub fn save_theme_as_custom_to_storage( &self, theme: &Theme, theme_name: &str, ) -> Result<()>
Save a specific theme as a custom theme to storage by name
Sourcepub fn delete_custom_theme(&self, name: &str, path: &Path) -> Result<()>
pub fn delete_custom_theme(&self, name: &str, path: &Path) -> Result<()>
Delete a custom theme file and unregister it
Sourcepub fn delete_custom_theme_from_storage(&self, theme_name: &str) -> Result<()>
pub fn delete_custom_theme_from_storage(&self, theme_name: &str) -> Result<()>
Delete a custom theme from storage and unregister it
Sourcepub fn custom_themes_directory() -> Result<PathBuf>
pub fn custom_themes_directory() -> Result<PathBuf>
Get the default custom themes directory
Sourcepub fn registry(&self) -> &ThemeRegistry
pub fn registry(&self) -> &ThemeRegistry
Get the theme registry
Sourcepub fn list_all_themes(&self) -> Result<Vec<String>>
pub fn list_all_themes(&self) -> Result<Vec<String>>
List all available themes (built-in and custom)
Sourcepub fn list_builtin_themes(&self) -> Vec<String>
pub fn list_builtin_themes(&self) -> Vec<String>
List all built-in themes
Sourcepub fn list_custom_themes(&self) -> Result<Vec<String>>
pub fn list_custom_themes(&self) -> Result<Vec<String>>
List all custom themes
Sourcepub fn register_theme(&self, theme: Theme) -> Result<()>
pub fn register_theme(&self, theme: Theme) -> Result<()>
Register a custom theme in the registry
Sourcepub fn unregister_theme(&self, name: &str) -> Result<()>
pub fn unregister_theme(&self, name: &str) -> Result<()>
Unregister a custom theme from the registry
Sourcepub fn theme_exists(&self, name: &str) -> bool
pub fn theme_exists(&self, name: &str) -> bool
Check if a theme exists
Sourcepub fn is_builtin_theme(&self, name: &str) -> bool
pub fn is_builtin_theme(&self, name: &str) -> bool
Check if a theme is built-in
Sourcepub fn is_custom_theme(&self, name: &str) -> Result<bool>
pub fn is_custom_theme(&self, name: &str) -> Result<bool>
Check if a theme is custom
Sourcepub fn builtin_theme_count(&self) -> usize
pub fn builtin_theme_count(&self) -> usize
Get the number of built-in themes
Sourcepub fn custom_theme_count(&self) -> Result<usize>
pub fn custom_theme_count(&self) -> Result<usize>
Get the number of custom themes
Sourcepub fn reset_colors(&self) -> Result<()>
pub fn reset_colors(&self) -> Result<()>
Reset all colors in the current theme to their default values
Sourcepub fn reset_theme(&self) -> Result<()>
pub fn reset_theme(&self) -> Result<()>
Reset the current theme to its built-in default
Sourcepub fn reset_color(&self, color_name: &str) -> Result<()>
pub fn reset_color(&self, color_name: &str) -> Result<()>
Reset a specific color field in the current theme to its default value
Sourcepub fn get_default_color(&self, color_name: &str) -> Result<Color>
pub fn get_default_color(&self, color_name: &str) -> Result<Color>
Get the default color value for a specific color field in the current theme
Sourcepub fn reset_manager(&self) -> &ThemeResetManager
pub fn reset_manager(&self) -> &ThemeResetManager
Get the theme reset manager
Trait Implementations§
Source§impl Clone for ThemeManager
impl Clone for ThemeManager
Source§fn clone(&self) -> ThemeManager
fn clone(&self) -> ThemeManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ThemeManager
impl Debug for ThemeManager
Auto Trait Implementations§
impl Freeze for ThemeManager
impl RefUnwindSafe for ThemeManager
impl Send for ThemeManager
impl Sync for ThemeManager
impl Unpin for ThemeManager
impl UnwindSafe for ThemeManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more