tca-ratatui
Ratatui integration for TCA themes. Loads base24 YAML theme files into ratatui::style::Color values ready to use in widgets and styles.
Installation
Loading a single theme
By name, slug, or file path
use TcaTheme;
// Theme name or slug — checks user themes, then built-ins
let theme = new;
let theme = new;
let theme = new; // flexible slug matching
// Exact file path
let theme = new;
// Auto-detect from terminal dark/light mode, then fall back to built-in default
let theme = new;
let theme = default; // same as new(None)
Loading a collection of themes
use TcaThemeCursor;
// All built-in themes
let mut cursor = with_builtins;
// User-installed themes from XDG data dir
let mut cursor = with_user_themes;
// Built-ins merged with user themes (user overrides on name match)
let mut cursor = with_all_themes;
// From an explicit list
let mut cursor = new;
Theme cursor navigation
use ;
let mut cursor = with_builtins;
// Current theme without moving
let theme: &TcaTheme = cursor.peek.unwrap;
// Advance (wraps at end)
let theme: &TcaTheme = cursor.next.unwrap;
// Retreat (wraps at start)
let theme: &TcaTheme = cursor.prev.unwrap;
println!;
println!;
for theme in cursor.themes
Using theme colors
use Style;
let normal = default.fg.bg;
let secondary = default.fg;
let muted = default.fg;
let border = default.fg;
let selection = default.bg.fg;
let error = default.fg;
let warning = default.fg;
let ansi_red = default.fg;
// Raw base24 slot access (index 0 = base00, index 8 = base08, etc.)
let darkest_bg = theme.base24;
let red_accent = theme.base24;
TcaTheme fallback behavior
TcaTheme::new() resolution order:
- User theme files —
~/.local/share/tca/themes/<name>.yaml, or an exact file path - Built-in themes — always available, no installation required
- Auto-detect — dark or light built-in based on the terminal's background color
If semantic or ui color references can't be resolved, they fall back to sensible ratatui named colors (e.g. Color::Red for semantic.error).
Built-in themes
| Slug | Style |
|---|---|
catppuccin-mocha |
dark |
cyberpunk |
dark |
dracula |
dark |
everforest-dark |
dark |
gruvbox-dark |
dark |
mono |
dark |
nord-dark |
dark |
one-dark |
dark |
rose-pine |
dark |
solarized-light |
light |
tokyo-night |
dark |
Color sections
TcaTheme
├── meta — name, author, dark
├── ansi — 16 ANSI colors (black, red, … bright_white) as Color::Rgb
├── semantic — error, warning, info, success, highlight, link
├── ui — bg_primary/secondary, fg_primary/secondary/muted,
│ border_primary/muted, cursor_primary/muted,
│ selection_bg/fg
└── base24 — [Color; 24] raw base24 slot colors (base00–base17)
Features
| Feature | Default | Description |
|---|---|---|
fs |
enabled | File I/O, TcaTheme::new(), TcaThemeCursor, base24 YAML parsing |
widgets |
enabled | ColorPicker widget |
# Builder-only, no file I/O or widgets
= { = "0.6", = false }
# With widgets only
= { = "0.6", = ["widgets"] }
Examples
# Interactive theme browser (cycles through all themes)
# Browse themes from a directory
# Browse built-ins only
License
MIT