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 containers;
39pub mod control;
40pub mod emoji;
41mod emoji_codes;
42pub mod errors;
43pub mod export;
44pub mod filesize;
45pub mod highlighter;
46pub mod json;
47pub mod layout;
48pub mod live;
49pub mod live_render;
50pub mod log_render;
51pub mod markdown;
52mod markdown_url;
53pub mod markup;
54pub mod measure;
55pub mod padding;
56pub mod pager;
57pub mod panel;
58pub mod pretty;
59pub mod progress;
60pub mod progress_bar;
61pub mod prompt;
62pub mod protocol;
63pub mod pyformat;
64pub mod ratio;
65pub mod region;
66mod repr_patterns;
67pub mod rule;
68pub mod screen;
69pub mod segment;
70pub mod spinner;
71mod spinner_data;
72pub mod status;
73pub mod style;
74pub mod styled;
75pub mod svg;
76pub mod syntax;
77pub mod table;
78pub mod terminal_theme;
79pub mod text;
80pub mod theme;
81pub mod traceback;
82pub mod tree;
83pub mod wrap;
84
85// A small, curated prelude mirroring the most-used names from `rich`'s top level.
86pub use crate::align::{Align, HorizontalAlign, VerticalAlign, VerticalCenter};
87pub use crate::ansi::AnsiDecoder;
88pub use crate::bar::Bar;
89pub use crate::color::{Color, ColorSystem, ColorTriplet};
90pub use crate::columns::Columns;
91pub use crate::console::{
92    Console, ConsoleDimensions, ConsoleOptions, Justify, Overflow, RenderStrOptions, ScreenUpdate,
93    ThemeContext,
94};
95pub use crate::constrain::Constrain;
96pub use crate::control::{Control, ControlType};
97pub use crate::emoji::EmojiVariant;
98pub use crate::errors::{Result, RichError};
99pub use crate::highlighter::{ISO8601Highlighter, RegexHighlighter, ReprHighlighter};
100pub use crate::json::Json;
101pub use crate::layout::{Layout, LayoutRender, Splitter};
102pub use crate::live::{AutoLive, Live, LivePanic};
103pub use crate::live_render::{LiveRender, VerticalOverflow};
104pub use crate::log_render::{level_text, LogLevel, LogRecord, LogRender};
105pub use crate::padding::Padding;
106pub use crate::pager::{Pager, SystemPager};
107pub use crate::panel::Panel;
108pub use crate::pretty::Pretty;
109pub use crate::progress::{
110    track, BarColumn, CustomColumn, CustomProgressColumn, LiveProgress, Progress, ProgressColumn,
111    ProgressReader, SpinnerColumn, Task, TaskId, TaskUpdate, TextColumn, TimeRemainingColumn,
112    Track, TrackStdout,
113};
114pub use crate::progress_bar::ProgressBar;
115pub use crate::protocol::{
116    CodeHighlighter, CodeHighlighting, ConsoleCodeHighlighting, FenceRenderer, HighlightError,
117    HighlightSpan, HighlightedCode, HighlightedLine, Highlighter, LineRenderable, Renderable,
118};
119pub use crate::region::Region;
120pub use crate::rule::Rule;
121pub use crate::screen::Screen;
122pub use crate::segment::Segment;
123pub use crate::spinner::Spinner;
124pub use crate::status::Status;
125pub use crate::style::{Meta, MetaValue, Style, StyleType};
126pub use crate::styled::Styled;
127pub use crate::syntax::{Syntax, SyntectHighlighter};
128pub use crate::table::{Cell, ColumnOptions, Table};
129pub use crate::terminal_theme::{
130    TerminalTheme, DEFAULT_TERMINAL_THEME, DIMMED_MONOKAI, MONOKAI, NIGHT_OWLISH, SVG_EXPORT_THEME,
131};
132pub use crate::text::Text;
133pub use crate::theme::Theme;
134pub use crate::traceback::Traceback;
135pub use crate::tree::Tree;