Skip to main content

max / alloy_tui

2.7 KB · 68 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 //! Every `docs/*.md` path in this crate's documentation names a file in the
13 //! Alloy repo, not this one. The design docs stayed behind when `alloy_tui`
14 //! was split out, so they are not published alongside these pages.
15 //!
16 //! Beyond the widgets, the crate carries the two things ratatui leaves to the
17 //! app and every Alloy TUI must agree on: the reserved keymap ([`keys`]) and
18 //! the focus ring ([`focus`]). Both descend from mountaineer-sysop's
19 //! `sysop-tui`, retinted from a const palette to the runtime [`Theme`].
20 //!
21 //! <!-- wiki: alloy-console -->
22
23 pub mod bevel;
24 pub mod connector;
25 pub mod cursor;
26 pub mod focus;
27 pub mod geometry;
28 pub mod help;
29 pub mod input;
30 pub mod keys;
31 pub mod layout;
32 pub mod selection;
33 pub mod text;
34 pub mod theme;
35 pub mod widgets;
36
37 pub use bevel::{Bevel, Elevation};
38 pub use connector::AlloyConnector;
39 pub use cursor::Cursor;
40 pub use focus::FocusRing;
41 pub use geometry::{Gap, padding};
42 pub use help::{AlloyKeymap, Binding, KeyGroup, binding, unavailable};
43 pub use input::TextField;
44 pub use keys::{Action, classify};
45 pub use layout::{ConsoleAreas, PaneAreas, console, panes};
46 pub use selection::{MARKER, selected_style};
47 pub use theme::{
48 Fidelity, Mode, Theme, ThemeError, border_strong, border_subtle, fidelity, mix_linear_srgb,
49 };
50 pub use widgets::*;
51
52 #[cfg(test)]
53 mod tests {
54 // The crate root is the API. Every one of these is reachable through its
55 // own module regardless, so a re-export missing from this list still
56 // compiles everywhere inside the crate and breaks only at a call site
57 // outside it. That is how 4.0.0 shipped without `fidelity`, which is the
58 // replacement the same release told callers to move to.
59 #[test]
60 fn the_names_a_caller_is_told_to_use_are_exported_from_the_root() {
61 let _: crate::Fidelity = crate::fidelity();
62 let _: fn(&makeover::ThemeColors) -> _ = crate::Theme::from_theme;
63 let _: fn(makeover::Rgb, makeover::Rgb) -> _ = crate::border_subtle;
64 let _: fn(makeover::Rgb, makeover::Rgb) -> _ = crate::border_strong;
65 let _: fn(makeover::Rgb, makeover::Rgb, f32) -> _ = crate::mix_linear_srgb;
66 }
67 }
68