max / alloy_tui
git clone https://makenot.work/git/max/alloy_tui.git
git clone git@ssh.makenot.work:max/alloy_tui.git
| Name | Size | |
|---|---|---|
| dist/ | ||
| scripts/ | ||
| src/ | ||
| .gitignore | 99 B | |
| bento.toml | 327 B | |
| Cargo.toml | 1.5 KB | |
| LICENSE | 1.0 KB | |
| README.md | 2.4 KB | |
| rust-toolchain.toml | 86 B |
README
alloy_tui
Alloy’s design system for ratatui: themed widgets, a reserved keymap, and a focus ring, driven by makeover themes.
Extracted from the Alloy console so other terminal UIs can share one look rather than each re-deriving colors from a palette.
What it gives you
Theme— a makeover.tomltheme resolved into ratatuiColor/Style. Two Alloy-specific tokens (border-subtle,border-strong) are derived locally so theme files stay minimal and cross-app compatible.- Widgets —
AlloyBlock,AlloyList,AlloyTabs,AlloyStatusBar,AlloyModal,AlloyLog, each taking a&Theme. - Forms —
AlloyFormoverAlloyFieldrows,AlloyPickerfor the filterable overlay a closed vocabulary opens, plus a display-onlyAlloyTable. One field widget carrying aFieldKindvalue cell rather than one widget per value type: the widgets own no value and do no validation, so they differ only in how the cell paints.TextFieldis the caret buffer a field shows in edit mode. keys— the reserved keymap every Alloy TUI agrees on, so the same keys mean the same thing across tools.focus— a focus ring, the piece ratatui deliberately leaves to the app.
Color is information
Chrome is tinted greyscale. Accent color lives on text, carried by Severity,
so a colored thing on screen means something rather than decorating. Widgets
enforce this; you get it by using them.
Usage
use alloy_tui::{AlloyStatusBar, Theme, hint};
// Resolve a makeover theme into ratatui colors.
let dirs = vec![(makeover::bundled_themes_dir().unwrap(), false)];
let colors = makeover::load_theme(&dirs, "akari-night").unwrap();
let theme = Theme::from_theme(&colors).unwrap();
// Widgets take &Theme.
let footer = AlloyStatusBar::new(&theme, [hint("Tab", "focus"), hint("q", "quit")]);
There is deliberately no built-in fallback palette. A missing or malformed theme is an error you surface, not something papered over by rendering in colors that exist nowhere in the theme files.
License
MIT.
Split out of the Alloy repository, which is GPLv3-or-later. This crate is permissive on purpose: it is the reusable design system, not the application, and other terminal UIs should be able to adopt the look without inheriting copyleft.