mirror-ghostty/example/zig-formatter
Mitchell Hashimoto 83a4f32a14
terminal: formatter improvements for color handling
2025-10-30 10:39:46 -07:00
..
src terminal: formatter improvements for color handling 2025-10-30 10:39:46 -07:00
README.md example/zig-formatter: show how to use formatters from libghostty (#9407) 2025-10-29 21:28:52 -07:00
build.zig example/zig-formatter: show how to use formatters from libghostty (#9407) 2025-10-29 21:28:52 -07:00
build.zig.zon example/zig-formatter: show how to use formatters from libghostty (#9407) 2025-10-29 21:28:52 -07:00

README.md

Example: stdin to HTML using vtStream and TerminalFormatter

This example demonstrates how to read VT sequences from stdin, parse them using vtStream, and output styled HTML using TerminalFormatter. The purpose of this example is primarily to show how to use formatters with terminals.

Requires the Zig version stated in the build.zig.zon file.

Usage

Basic usage:

echo -e "Hello \033[1;32mGreen\033[0m World" | zig build run

This will output HTML with inline styles and CSS palette variables.

You can also pipe complex terminal output:

ls --color=always | zig build run > output.html