Available on crate feature
theme only.Expand description
Theme persistence for saving and loading user theme preferences.
This module provides functions to save and load the user’s selected theme to a configuration file, allowing the preference to persist across sessions.
§Default Config Location
By default, the config is stored at:
- Linux/macOS:
~/.config/ratatui-toolkit/theme.json - Windows:
%APPDATA%\ratatui-toolkit\theme.json
§Example
use ratatui_toolkit::services::theme::persistence::{save_theme, load_saved_theme};
// Save the current theme
save_theme("ayu", None).ok();
// Load the saved theme on startup
if let Some(theme_name) = load_saved_theme(None) {
println!("Loaded theme: {}", theme_name);
}Structs§
- Theme
Config - Configuration structure for persisted theme settings.
Functions§
- clear_
saved_ theme - Clears the saved theme preference.
- default_
config_ dir - Gets the default config directory for theme settings.
- default_
config_ path - Gets the default path for the theme config file.
- load_
saved_ theme - Loads the saved theme name from the config file.
- save_
theme - Saves the selected theme to a config file.