Install and get started with Terminal-RichJS.
Terminal-RichJS works with macOS, Linux, and Windows. It requires Node.js 16.0.0 or above.
Install Terminal-RichJS with npm or your favorite package manager:
npm install terminal-richjsimport { Console, Panel, Table, Tree } from "terminal-richjs";
const console = new Console();
// Styled text
console.print("[bold cyan]Welcome to RichJS![/bold cyan]");
console.print(
"[#ff79c6]Hex colors[/#ff79c6] and [rgb(80,250,123)]RGB[/rgb(80,250,123)] work too!",
);
// Panel with title
console.print(
new Panel("Hello, World!", {
title: "Greeting",
titleAlign: "left",
box: "rounded",
}),
);
// Simple table
const table = new Table({ box: "rounded" });
table.addColumn("Name");
table.addColumn("Value");
table.addRow("foo", "bar");
table.addRow("baz", "qux");
console.print(table);
// File tree
const tree = new Tree("📁 src");
tree.add("📄 index.ts");
tree.add("📄 utils.ts");
console.print(tree);Run the visual demo to see all features:
npx tsx examples/visual-polish-demo.ts// Core
export { Console } from "./console/console";
export { Style } from "./core/style";
export { Segment } from "./core/segment";
// Renderables
export { Text } from "./renderables/text";
export { Panel } from "./renderables/panel";
export { Table } from "./renderables/table";
export { Tree } from "./renderables/tree";
export { Rule } from "./renderables/rule";
export { Padding } from "./renderables/padding";
export { Align } from "./renderables/align";
// Syntax Highlighting
export { Syntax } from "./syntax/syntax";
export {
MONOKAI,
DRACULA,
GITHUB_LIGHT,
ONE_DARK,
getTheme,
} from "./syntax/theme";
// Traceback
export { Traceback, installTracebackHandler } from "./traceback/traceback";
// Progress
export {
ProgressBar,
PercentageColumn,
TimeElapsedColumn,
TimeRemainingColumn,
} from "./progress/bar";
export { Progress } from "./progress/progress";
// Utilities
export { getBox, listBoxStyles } from "./utils/box";
export { inspect } from "./utils/inspect";