A TypeScript library for rich terminal output with colors, styles, and components.
Terminal-RichJS is a TypeScript library for rich terminal output, providing features like styled text, tables, panels, trees, syntax highlighting, and progress bars.
The Console class is the main entry point for rendering content to the terminal.
import { Console } from "terminal-richjs";
const console = new Console();print(...objects: any[]): voidPrint one or more objects to the console. Strings are parsed for markup.
console.print("Hello, [bold]World[/bold]!");
console.print(new Panel("Content"), new Table());log(...objects: any[]): voidAlias for print().
render(renderable: Renderable): stringRender a renderable object to a string without printing.
const output = console.render(new Panel("Hello"));width: number - Terminal width in columnsRichJS supports rich markup syntax similar to Python Rich.
// Basic styles
"[bold]Bold text[/bold]";
"[italic]Italic text[/italic]";
"[underline]Underlined[/underline]";
"[dim]Dimmed text[/dim]";
"[strikethrough]Crossed out[/strikethrough]";
// Combined styles
"[bold italic red]Bold italic red[/bold italic red]";
// Short closing tag
"[bold]Bold[/]"; // Closes all open styles"[red]Red[/red]";
"[green]Green[/green]";
"[blue]Blue[/blue]";
"[bright_red]Bright red[/bright_red]";"[#ff0000]Red[/#ff0000]";
"[#ff79c6]Dracula Pink[/#ff79c6]";"[rgb(255,0,0)]Red[/rgb(255,0,0)]";Prefix any color format with on for background:
"[on red]Red background[/on red]";
"[on #282a36]Hex background[/on #282a36]";import { Style } from "terminal-richjs";
const style = Style.parse("bold red on white");
const combined = style.combine(Style.parse("italic"));