Skip to main content

rich/
lib.rs

1//! # rich
2//!
3//! A **faithful** Rust port of the Python [`rich`](https://github.com/Textualize/rich)
4//! terminal-rendering library. This crate mirrors upstream module-for-module.
5//! Its version is independent SemVer; the upstream release it reflects
6//! (currently `rich` 15.0.0) is recorded in `UPSTREAM.toml`.
7//!
8//! Local features and the plugin registry live in the separate `rich-ext` crate
9//! — do **not** add non-upstream behavior here. See `AGENTS.md`.
10//!
11//! ## What is ported
12//!
13//! - Console and styling: [`console`], [`style`], [`color`], [`segment`],
14//!   [`markup`], [`theme`], [`control`], [`screen`], [`export`].
15//! - Text: [`text`], [`cells`], [`wrap`], [`emoji`], [`highlighter`], [`ansi`].
16//! - Renderables: [`panel`], [`table`], [`tree`], [`layout`], [`columns`],
17//!   [`align`], [`padding`], [`constrain`], [`rule`], [`bar`], [`markdown`],
18//!   [`syntax`], [`json`], [`pretty`], [`traceback`], [`log_render`].
19//! - Live output: [`live`], [`progress`] (with [`track`]), [`progress_bar`],
20//!   [`spinner`], [`status`].
21//! - Input and paging: [`prompt`], [`pager`].
22//! - Extension points: [`protocol`], [`measure`].
23//!
24//! Most modules are partial ports of their upstream counterpart; the per-module
25//! status and parity evidence are in `docs/PORTING.md`.
26
27pub mod align;
28pub mod ansi;
29pub mod bar;
30pub mod r#box;
31mod cell_widths;
32pub mod cells;
33pub mod color;
34mod color_names;
35pub mod columns;
36pub mod console;
37pub mod constrain;
38pub mod control;
39pub mod emoji;
40mod emoji_codes;
41pub mod errors;
42pub mod export;
43pub mod filesize;
44pub mod highlighter;
45pub mod json;
46pub mod layout;
47pub mod live;
48pub mod live_render;
49pub mod log_render;
50pub mod markdown;
51mod markdown_url;
52pub mod markup;
53pub mod measure;
54pub mod padding;
55pub mod pager;
56pub mod panel;
57pub mod pretty;
58pub mod progress;
59pub mod progress_bar;
60pub mod prompt;
61pub mod protocol;
62pub mod pyformat;
63pub mod ratio;
64mod repr_patterns;
65pub mod rule;
66pub mod screen;
67pub mod segment;
68pub mod spinner;
69mod spinner_data;
70pub mod status;
71pub mod style;
72pub mod styled;
73pub mod svg;
74pub mod syntax;
75pub mod table;
76pub mod terminal_theme;
77pub mod text;
78pub mod theme;
79pub mod traceback;
80pub mod tree;
81pub mod wrap;
82
83// A small, curated prelude mirroring the most-used names from `rich`'s top level.
84pub use crate::align::{Align, HorizontalAlign};
85pub use crate::ansi::AnsiDecoder;
86pub use crate::bar::Bar;
87pub use crate::color::{Color, ColorSystem, ColorTriplet};
88pub use crate::columns::Columns;
89pub use crate::console::{Console, ConsoleOptions, Justify, Overflow, ThemeContext};
90pub use crate::constrain::Constrain;
91pub use crate::control::{Control, ControlType};
92pub use crate::errors::{Result, RichError};
93pub use crate::highlighter::{ISO8601Highlighter, RegexHighlighter, ReprHighlighter};
94pub use crate::json::Json;
95pub use crate::layout::Layout;
96pub use crate::live::{AutoLive, Live, LivePanic};
97pub use crate::live_render::LiveRender;
98pub use crate::log_render::{level_text, LogLevel, LogRecord, LogRender};
99pub use crate::padding::Padding;
100pub use crate::pager::{Pager, SystemPager};
101pub use crate::panel::Panel;
102pub use crate::pretty::Pretty;
103pub use crate::progress::{
104    track, BarColumn, LiveProgress, Progress, ProgressColumn, ProgressReader, SpinnerColumn, Task,
105    TaskId, TaskUpdate, TextColumn, TimeRemainingColumn, Track, TrackStdout,
106};
107pub use crate::progress_bar::ProgressBar;
108pub use crate::protocol::{Highlighter, LineRenderable, Renderable};
109pub use crate::rule::Rule;
110pub use crate::screen::Screen;
111pub use crate::segment::Segment;
112pub use crate::spinner::Spinner;
113pub use crate::status::Status;
114pub use crate::style::{Style, StyleType};
115pub use crate::styled::Styled;
116pub use crate::syntax::Syntax;
117pub use crate::table::{Cell, ColumnOptions, Table};
118pub use crate::terminal_theme::{
119    TerminalTheme, DEFAULT_TERMINAL_THEME, DIMMED_MONOKAI, MONOKAI, NIGHT_OWLISH, SVG_EXPORT_THEME,
120};
121pub use crate::text::Text;
122pub use crate::theme::Theme;
123pub use crate::traceback::Traceback;
124pub use crate::tree::Tree;