Skip to main content

max / alloy_tui

2.4 KB · 64 lines History Blame Raw
1 //! Alloy design system for ratatui.
2 //!
3 //! Consumes makeover `.toml` themes (the same schema every make-family app
4 //! reads) and renders them as ratatui `Color` / `Style`. Two Alloy-specific
5 //! tokens (`border-subtle`, `border-strong`) are derived locally so theme
6 //! files stay minimal — see `docs/TOKENS.md` for the storage format and
7 //! derivation math, `docs/CONSOLE.md` for the widget roster this crate
8 //! targets, and `docs/DESIGN-LANGUAGE.md` for the color-is-information rule
9 //! enforced here: chrome is tinted-greyscale, accents live on text via
10 //! `Severity`.
11 //!
12 //! Beyond the widgets, the crate carries the two things ratatui leaves to the
13 //! app and every Alloy TUI must agree on: the reserved keymap ([`keys`]) and
14 //! the focus ring ([`focus`]). Both descend from mountaineer-sysop's
15 //! `sysop-tui`, retinted from a const palette to the runtime [`Theme`].
16 //!
17 //! <!-- wiki: alloy-console -->
18
19 pub mod bevel;
20 pub mod connector;
21 pub mod cursor;
22 pub mod focus;
23 pub mod geometry;
24 pub mod help;
25 pub mod input;
26 pub mod keys;
27 pub mod layout;
28 pub mod selection;
29 pub mod text;
30 pub mod theme;
31 pub mod widgets;
32
33 pub use bevel::{Bevel, Elevation};
34 pub use connector::AlloyConnector;
35 pub use cursor::Cursor;
36 pub use focus::FocusRing;
37 pub use geometry::{Gap, padding};
38 pub use help::{AlloyKeymap, Binding, KeyGroup, binding, unavailable};
39 pub use input::TextField;
40 pub use keys::{Action, classify};
41 pub use layout::{ConsoleAreas, PaneAreas, console, panes};
42 pub use selection::{MARKER, selected_style};
43 pub use theme::{
44 Fidelity, Mode, Theme, ThemeError, border_strong, border_subtle, fidelity, mix_linear_srgb,
45 };
46 pub use widgets::*;
47
48 #[cfg(test)]
49 mod tests {
50 // The crate root is the API. Every one of these is reachable through its
51 // own module regardless, so a re-export missing from this list still
52 // compiles everywhere inside the crate and breaks only at a call site
53 // outside it. That is how 4.0.0 shipped without `fidelity`, which is the
54 // replacement the same release told callers to move to.
55 #[test]
56 fn the_names_a_caller_is_told_to_use_are_exported_from_the_root() {
57 let _: crate::Fidelity = crate::fidelity();
58 let _: fn(&makeover::ThemeColors) -> _ = crate::Theme::from_theme;
59 let _: fn(makeover::Rgb, makeover::Rgb) -> _ = crate::border_subtle;
60 let _: fn(makeover::Rgb, makeover::Rgb) -> _ = crate::border_strong;
61 let _: fn(makeover::Rgb, makeover::Rgb, f32) -> _ = crate::mix_linear_srgb;
62 }
63 }
64