tca-loader
XDG-compliant theme file discovery and loading for TCA.
Overview
Provides filesystem operations for discovering and loading TCA theme files, and reading user preferences. Used internally by tca-ratatui — most projects won't need to depend on this directly.
Installation
Theme directory
Themes are .toml files stored in ~/.local/share/tca-themes/ (or $XDG_DATA_HOME/tca-themes/). Any file placed there is automatically discoverable by all TCA-powered apps.
API
Discovery
use ;
let dir = get_themes_dir?; // PathBuf to the themes directory
let paths = list_themes?; // Vec<PathBuf> — all .toml files
let names = list_theme_names?; // Vec<String> — names without extension
Loading
use load_theme_file;
// Accepts a name ("nord"), a name with extension ("nord.toml"),
// or any file path ("/path/to/theme.toml")
let toml_str: String = load_theme_file?;
// Parse with tca-types
let theme: Theme = from_str?;
User preferences
use TcaConfig;
// Reads ~/.config/tca/tca.toml
let config = load;
// Returns the best theme name for the current terminal mode
// (dark_theme, light_theme, or default_theme depending on what's configured)
if let Some = config.mode_aware_theme
// Persist preferences
let config = TcaConfig ;
config.store;
License
MIT