tca-ratatui
Ratatui integration for TCA themes. One call gets you a fully resolved theme from the user's installed themes, built-ins, or a sensible auto-detected default.
Quick start
[]
= "0.1"
use TcaTheme;
use Style;
// Load by name, file path, or let the library choose
let theme = new;
let theme = new;
let theme = new; // auto-detects dark/light
// Use the colors
let normal = default.fg.bg;
let error = default.fg;
let border = default.fg;
let ansi = default.fg;
How TcaTheme::new() resolves a theme
Each step falls through to the next on failure:
- User theme files —
~/.local/share/tca-themes/<name>.toml, or an exact file path - Built-in themes — always available, no installation required
- User preference — configured default in
~/.config/tca/tca.toml - Auto-detect — picks dark or light built-in from the terminal's background color
This means your app works out of the box and gives users full control without any extra code on your part.
Built-in themes
| Slug | Style |
|---|---|
catppuccin-mocha |
dark |
cyberpunk |
dark |
dracula |
dark |
everforest-dark |
dark |
gruvbox-dark |
dark |
mono |
dark |
nord |
dark |
one-dark |
dark |
rose-pine |
dark |
solarized-light |
light |
tokyo-night |
dark |
Color sections
TcaTheme
├── meta — name, author, version, description
├── 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
├── palette — named color ramps (e.g. neutral.0–7, red.0–2)
└── base16 — base00–base0F if the theme defines them
Fallbacks: if semantic or ui colors can't be resolved from the theme file, they fall back to sensible ratatui named colors (e.g. Color::Red for semantic.error).
Programmatic themes
Use TcaThemeBuilder to construct a theme entirely in code:
use ;
use Color;
let theme = new
.semantic
.build;
Loading from a TOML string
let theme = try_from.expect;
Features
| Feature | Default | Description |
|---|---|---|
loader |
✓ | File I/O, TcaTheme::new(), TOML parsing |
widgets |
— | ColorPicker widget |
# Widgets
= { = "0.1", = ["widgets"] }
Examples
# Interactive theme browser
# Pass a directory of .toml files
# Browse built-ins
License
MIT