tca-ratatui
Ratatui integration for TCA themes. Loads base24 YAML theme files into ready-to-use ratatui::style::Style values and ratatui::style::Color values.
Installation
Quick Start - StyleSet
The easiest way to theme a ratatui app is with [StyleSet]. It pre-builds all the common styles you need from the user's configured theme:
use StyleSet;
use ;
Load by name, or cycle through available themes:
use ;
// Load a specific theme by name (any case format works)
let styles = from_name;
let styles = from_name;
// Cycle through all installed + built-in themes
let mut cursor = with_all_themes;
cursor.set_current;
let styles = cursor.peek.unwrap_or_default;
cursor.next;
cursor.prev;
Available styles on StyleSet:
| Field | Use for |
|---|---|
primary |
Normal text, main content |
secondary |
Sidebars, panels, secondary content |
muted |
Disabled, hints, placeholders |
selection |
Selected items, highlighted rows |
cursor |
Active cursor |
cursor_muted |
Inactive cursor |
border |
Active/focused borders |
border_muted |
Inactive borders |
error |
Error messages |
warning |
Warnings |
info |
Informational text, spinners |
success |
Success messages |
highlight |
Important text, search matches |
link |
URLs, hyperlinks |
Custom styles can be added at runtime with insert_custom / get_custom.
Lower-Level Access - TcaTheme
For direct access to typed colors (e.g. for custom style composition):
use TcaTheme;
use Style;
let theme = from_name;
let theme = default; // user's configured default
let error = default.fg;
let border = default.fg;
let bg = default.bg;
let red = theme.ansi.red;
// Raw base24 slots (index 0 = base00, index 8 = base08, etc.)
let darkest_bg = theme.base24;
Theme Resolution Order
TcaTheme::from_name("name") / TcaTheme::default():
- User theme files:
~/.local/share/tca/themes/<name>.yaml, or an exact file path - Built-in themes: always available, no installation required
- User config default:
~/.config/tca/tca.toml - Built-in default (
catppuccin-mocha)
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)
├── 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, from_name, cursors, YAML parsing |
widgets |
enabled | ColorPicker widget |
# Builder-only, no file I/O or widgets
= { = "0.7", = false }
# File I/O only, no widgets
= { = "0.7", = ["fs"] }
Examples
# StyleSet demo: shows all styles, cycles themes with ← →
# Interactive theme color browser
# Browse themes from a directory
License
MIT