tca-ratatui
Ratatui adapter for Terminal Colors Architecture (TCA) themes.
Overview
This crate provides types and widgets for using TCA themes in Ratatui applications. It converts TCA theme files (TOML) into Ratatui-compatible Color values.
Installation
[]
= "0.1"
Features
loader(default): File I/O and theme loadingwidgets: Color picker widget
Disable default features for no-std environments or when using pre-loaded themes:
= { = "0.1", = false }
Usage
Loading Themes
use TcaTheme;
use Style;
let theme = from_file?;
// Access color sections directly
let error_style = default.fg;
let ui_bg = default.bg;
let semantic_warn = default.fg;
Color Picker Widget
use ColorPicker;
let picker = new
.title
.instructions;
frame.render_widget;
Type Hierarchy
TcaTheme
- Meta - Name, author, version
- Palette - Neutral and hue ramps (red, blue, etc.)
- Ansi - 16 ANSI colors
- Semantic - Error, warning, success, info, highlight, link
- Ui - Background, foreground, border, cursor, selection
Defaults
Semantic and Ui sections use sensible ANSI color fallbacks when missing from theme files:
Semantic: Red for error, yellow for warning, etc.Ui: Black background, white foreground, etc.
Examples
See examples/ directory:
basic.rs- Theme loading and color accesspicker.rs- Interactive theme picker application
Run with:
TCA Specification
For theme file format details, see the TCA specification.
License
MIT