Themes
A Theme is a palette of semantic color roles, and it is the only styling most apps touch: every component derives its default look from roles such as background, surface, field, primary, secondary, accent, destructive, warning, border, ring, and cursor. Most roles have a foreground companion chosen to contrast with the fill. Two less obvious ones: ring is the focus accent around a container (a focused pane's border, the dialog frame), and cursor is the text caret.
Choose one built-in preset directly:
use ratcn::Theme;
let theme = Theme::catppuccin();
ratcn.render(frame, &state, &theme, |ctx| {
// Declare components.
});The presets are default_dark, terminal, catppuccin, gruvbox, nord, tokyo_night, and solarized. Theme::presets() returns all seven in stable picker order.
To author a palette, start from a preset and replace the roles you care about. (Theme stores its display name as a &'static str, so authored names must be static in the current API.)
use ratatui::style::Color;
use ratcn::Theme;
const THEME: Theme = Theme {
name: "Operations",
accent: Color::LightCyan,
warning: Color::LightYellow,
..Theme::default_dark()
};Pass the same theme to runtime rendering and paint-only widgets so both halves of the library agree. To recolor a single component, use that component's .style(|theme| ...) override — see each component page's Styling section — rather than adding a palette role.