โจ Features
-
๐จ Style โ 13 text attributes (bold, italic, underline, dim, blink, reverse, strikethrough, overline, conceal, frame, encircle, blink2, underline2), links, metadata, style chaining & combination
-
๐ Console markup โ
[bold red]text[/bold red]BBCode-like inline styling -
๐ฏ 256 named colors โ full ANSI 256-color palette with aliases, hex, RGB, auto-downgrade, color blending
-
๐ญ 170+ theme styles โ repr, json, markdown, logging, traceback, rule, bar, progress, table, tree, syntax, prompt categories with stack-based inheritance
-
๐ Table โ tabular data with headers, footers, row/column styling, colspan/rowspan, sections, 17 box styles,
.grid()classmethod -
๐ฒ Tree โ hierarchical tree rendering with Unicode/ASCII guides
-
๐ฆ Panel โ bordered containers with titles, subtitles, padding,
.fit()for auto-sizing -
โ Rule โ horizontal dividers with optional centered, left-, or right-aligned titles
-
๐ Padding & Align โ CSS-style padding (1โ4 sides) and horizontal/vertical alignment wrappers
-
๐ Columns โ side-by-side column layout with equal-width and expand options
-
๐๏ธ Layout โ recursive split-pane layout engine with ratio sizing, named regions, and pluggable splitters
-
โณ Progress โ multi-task progress bars with 11 column types,
track()/wrap_file()/open()wrappers, file tracking -
๐ Spinner โ 55 animated spinners with case-insensitive name lookup
-
๐ Status โ spinner + message with in-place refresh
-
๐ Live โ auto-updating displays with
LiveWriterfor stdout/stderr capture -
๐ Syntax highlighting โ powered by syntect (100+ languages),
.from_path(),.guess_lexer(),.stylize_range() -
๐ Markdown โ headings, code blocks, lists, blockquotes, links, tables, image placeholders
-
๐ JSON โ pretty-printed, syntax-highlighted JSON
-
๐ Logging โ
RichHandlerfor thelogcrate + standaloneLogRenderformatter with table output -
๐ผ๏ธ Box drawing โ 17 box styles (rounded, square, heavy, double, ASCII, markdown, etc.)
-
๐ฅ๏ธ Screen / Alt-screen โ full-screen terminal applications with
ScreenContextRAII guard -
โจ๏ธ Prompts โ
Prompt,IntPrompt,FloatPrompt,Confirm,Select, password mode -
๐ด Traceback โ rich exception rendering with locals, source code, frame suppression, panic hook
-
๐ Inspect โ structured object introspection with attribute and method tables
-
๐๏ธ Control โ composable terminal escape sequences (cursor, screen, title, bell, erase)
-
๐ค HTML & SVG export โ capture console output for the web with 4 preset themes
-
๐ Emoji โ 100+
:shortcode:โ Unicode emoji replacement -
๐ Palette โ gradient, rainbow, and monochrome color palette generation
-
๐ Bar chart โ horizontal bar chart renderable with labels and auto-scaling
-
๐จ๏ธ Pretty printing โ
Pretty,pprint(),pretty_repr(),traverse()withNodetree -
๐ Pager โ system pager integration (
$PAGER/less) withPagerContextRAII -
๐ค ANSI decoder โ parse existing ANSI escape sequences back to styled
Text -
๐งฉ Segment utilities โ simplify, split_lines, strip_styles, strip_links, align, divide, set_shape, filter_control
๐ฆ Installation
[]
= "0.4"
๐ Quick Start
use ;
๐ฏ Colors (256 names)
use ;
// Named colors โ 256 ANSI palette
let red = parse.unwrap;
let hot_pink = parse.unwrap;
let steel_blue = parse.unwrap;
let grey53 = parse.unwrap;
// Hex / RGB
let orange = from_hex.unwrap;
let custom = from_rgb;
// TrueColor โ 8-bit โ Standard auto-downgrade
let style = new
.color
.bgcolor
.bold
.italic;
๐ Table with Colspan & Rowspan
use ;
let mut table = new.title;
table.add_column;
table.add_column; // spans 2 columns
table.add_column; // skipped by colspan above
let row = vec!;
table.add_row;
โณ Progress Bars
use Progress;
use thread;
use Duration;
let mut progress = new;
let task_id = progress.add_task;
for i in 0..=100
println!;
// Or use the `track()` convenience with an iterator
let items: = .collect;
let tracker = progress.track;
for item in tracker
๐ Markdown (with tables)
use render_markdown;
use Console;
let md = render_markdown;
let console = new;
console.println;
โจ๏ธ Interactive Prompts
use ;
// String input
let name = ask_with.unwrap;
// Password input (masked with *)
let password = new.password.ask.unwrap;
// Confirmation with default
let ok = ask_with.unwrap;
// Integer with validation
let age = ask_with.unwrap;
// Pick from numbered choices
let choice = new
.choice
.choice
.choice
.ask
.unwrap;
๐ Live Display with Writer
use ;
use Write;
use thread;
use Duration;
let mut live = new;
let mut writer = live.create_writer;
live.start.unwrap;
for i in 0..=100
live.stop.unwrap;
๐ด Rich Tracebacks
use traceback;
// Install a global panic hook for rich tracebacks
install;
// Or render manually
let tb = from_exception
.show_locals
.max_frames
.suppress;
๐ Object Inspection
use Inspect;
// Inspect any Debug-printable value
let value = vec!;
let insp = new
.title
.add_attr
.add_attr
.add_method
.add_method
.methods;
๐๏ธ Terminal Control Sequences
use ;
// Ring the bell
let bell = bell;
// Clear screen and go home
let clear = clear_home;
// Move cursor and set window title
let setup = cursor_to;
let title = title;
// Strip or escape control codes from strings
use ;
let clean = strip_control_codes; // "helloworld"
let escaped = escape_control_codes; // "\\a"
๐ Log Record Formatting
use LogRender;
let mut renderer = new
.show_time
.show_level
.show_path;
// Format a single log record
let record = renderer.render_log;
// Or render a batch as a table
let records = vec!;
let table = renderer.render_batch;
๐ฅ๏ธ Full-Screen Apps
use ;
use thread;
use Duration;
let mut console = new;
let mut screen = console.screen; // enters alternate screen
screen.enter;
let mut live = new;
live.start.unwrap;
for i in 0..=100
live.stop.unwrap;
screen.exit; // restores terminal
๐จ Box Styles (17 built-in)
| Style | Preview |
|---|---|
BOX_ROUNDED |
โญโโฎ โ โ โฐโโฏ |
BOX_SQUARE |
โโโ โ โ โโโ |
BOX_HEAVY |
โโโ โ โ โโโ |
BOX_DOUBLE |
โโโ โ โ โโโ |
BOX_DOUBLE_EDGE |
โโโ โ โ โโโ |
BOX_HEAVY_EDGE |
โโโ โ โ โโโ |
BOX_HEAVY_HEAD |
โโโ โ โ โโโ |
BOX_SIMPLE |
borderless with separators |
BOX_SIMPLE_HEAVY |
borderless with heavy separators |
BOX_MINIMAL |
minimal horizontal rules |
BOX_ASCII |
+--+ ASCII-safe |
BOX_ASCII2 |
+--+ alternate ASCII |
BOX_MARKDOWN |
pipe-style markdown tables |
| โฆ and 4 more |
๐งฉ Segment Utilities
use ;
let segs: Segments = vec!.into;
// Combine adjacent same-styled segments
let simplified = segs.simplify; // โ one "Hello World" segment
// Split into lines
let lines = split_lines;
// Strip all styling
let plain = strip_styles; // โ "Hello World"
// Align vertically
let aligned = align_middle;
๐ Module Map (48 modules)
src/
โโโ lib.rs # Crate root + re-exports (~100 types)
โโโ console.rs # Central rendering engine (148 methods)
โโโ screen.rs # Full-screen / alt-screen / ScreenContext
โโโ color.rs # TrueColor / 256 / Standard (256 names)
โโโ style.rs # 13 attributes + links + metadata + chain/copy
โโโ theme.rs # 170+ named styles + stack-based inheritance
โโโ segment.rs # Segment + control codes + 15+ utility fns
โโโ text.rs # Text with Span styling (99 methods)
โโโ cells.rs # Unicode cell width utilities
โโโ measure.rs # Width measurement protocol
โโโ align.rs # Horizontal + vertical alignment
โโโ ratio.rs # Proportional space distribution
โโโ markup.rs # BBCode-like markup parser
โโโ highlighter.rs # Regex/Repr/ISO8601/JSON/Path highlighters
โ
โโโ panel.rs # Bordered container + .fit()
โโโ table.rs # Tabular data + Row/Cell + sections + .grid()
โโโ tree.rs # Hierarchical tree with guides
โโโ rule.rs # Horizontal divider with title
โโโ padding.rs # CSS-style padding (1โ4 sides)
โโโ columns.rs # Side-by-side column layout
โโโ layout.rs # Split-pane layout + 4 splitter types
โโโ box_drawing.rs # 17 box/border styles
โ
โโโ progress.rs # Multi-task progress + track/wrap_file/open
โโโ progress_columns.rs # 11 progress column types
โโโ spinner.rs # 55 animated spinners + get_spinner()
โโโ status.rs # Animated spinner + message
โโโ live.rs # Auto-updating display + LiveWriter
โ
โโโ syntax.rs # Syntax highlighting (syntect, 100+ langs)
โโโ markdown.rs # Markdown rendering + table + image support
โโโ json.rs # Pretty-printed, syntax-highlighted JSON
โโโ logging.rs # RichHandler for the log crate
โโโ log_render.rs # Standalone LogRender formatter (new in 0.3!)
โโโ prompt.rs # 5 interactive prompt types + Select
โโโ traceback.rs # Rich exception tracebacks + panic hook
โ
โโโ inspect.rs # Object introspection (new in 0.3!)
โโโ control.rs # Terminal control sequences (new in 0.3!)
โโโ pretty.rs # Pretty printing + Node tree traversal
โโโ emoji.rs # 100+ :shortcode: โ Unicode emoji
โโโ pager.rs # System pager ($PAGER / less) + PagerContext
โโโ constrain.rs # Width constraint wrapper
โโโ styled.rs # Pre-styled renderable wrapper
โโโ bar.rs # Horizontal bar chart renderable
โโโ filesize.rs # Human-readable file size + speed formatting
โโโ containers.rs # Lines + Renderables grouping
โโโ palette.rs # Gradient/rainbow/monochrome palettes
โโโ diagnose.rs # Error diagnostics + reporting
โโโ ansi.rs # ANSI escape sequence decoder
โโโ scope.rs # Variable scope rendering
โโโ file_proxy.rs # Auto-refreshing file display
โโโ repr.rs # RichRepr trait + auto/rich_repr
โโโ export.rs # HTML / SVG / text export + 4 themes
๐ฌ Compared to Python Rich
| Feature | Python Rich | rusty-rich |
|---|---|---|
| Console + markup | โ | โ |
| Text / Span / Style (full API) | โ | โ |
| 256 named colors | โ | โ |
| Table (colspan/rowspan/sections/grid) | โ | โ |
| Panel / Rule / Tree | โ | โ |
| Layout with splitters | โ | โ |
| Progress (11 column types, track/wrap/open) | โ | โ |
| Live / Status | โ | โ |
| Syntax highlighting + lexer guessing | โ | โ |
| Markdown + tables + images | โ | โ |
| JSON / Logging / LogRender | โ | โ |
| Traceback (locals, suppress, panic hook) | โ | โ |
| Screen / Alt-screen | โ | โ |
| Prompts (5 types + Select) | โ | โ |
| Pretty printing + Node tree | โ | โ |
| Object inspection (Inspect) | โ | โ (new in 0.3!) |
| Terminal control sequences (Control) | โ | โ (new in 0.3!) |
| Emoji + ANSI decoder | โ | โ |
| System pager + PagerContext | โ | โ |
| Palette (gradient/rainbow) | โ | โ |
| Bar chart | โ | โ |
| FileProxy / Scope / Diagnose | โ | โ |
| Constrain / Styled / Containers | โ | โ |
| Repr protocol (RichRepr) | โ | โ |
| Color property accessors | โ | โ (new in 0.3!) |
| ISO8601/JSON/Path highlighters | โ | โ (new in 0.3!) |
| Filesize.decimal() (SI units) | โ | โ (new in 0.3!) |
| Capture / RenderHooks / ThemeContext | โ | โ |
| 55+ Spinners | 80+ | 55 |
| 17 Box styles | 20 | 17 |
| HTML / SVG / Text export | โ | โ |
| 170+ Theme styles | 170+ | 170+ |
| Markdown element tree (extensible) | โ | โ |
| Pygments theme bridge | โ | โ (uses syntect) |
| Jupyter support | โ | N/A |
| Overall parity | ~88% |
๐งช Testing
All 778 tests passing. The exhaustive test suite covers every box style ร every feature combination (colspan, rowspan, sections, alignment, padding, etc.).
๐ License
MIT โ See LICENSE for details.