Creates beautiful screenshots of terminal command output with full local font and emoji support.
pnpx termsnap "lolcat -f <(figlet -f banner3 termsnap)"
This project leverages Go-based terminal output proxy combined with web rendering technology to deliver pixel-perfect terminal screenshots.
- Interactive Terminal Support: Capture interactive terminal sessions through Go-based terminal output proxy
- Local Font & Emoji Support: Perfect rendering of your system fonts and emoji characters
- Customizable Themes: Extensive theme customization through configuration files
- Multiple Output Formats: Export as HTML, images (PNG/JPEG/WebP), or browser preview
# Browser preview
pnpx termsnap "command" --open
# Save as HTML file
pnpx termsnap "command" --html index.html
# Save as screenshot
pnpx termsnap "command" --screenshot image.png
# Custom theme and decoration
pnpx termsnap "command" --open --theme vitesse-light --decoration
Generate your terminal output in multiple formats:
- HTML: Save as standalone HTML file with embedded styling
- Images: Export as PNG, JPEG, or WebP formats
- Browser Preview: Open directly in browser (powered by Broz)
In some cases, especially with custom fonts, width and height calculations may be inaccurate. When this occurs, you can manually set the height
and width
parameters to force specific viewport dimensions.
When setting lineHeight
greater than 1, box drawing characters may appear discontinuous with gaps between adjacent lines due to limitations in xterm.js rendering.
termsnap supports termsnap.config.ts
for persistent configuration and theme customization. You can:
- Use built-in themes (vitesse, catppuccin)
- Use remote themes from iTerm2-Color-Schemes VSCode directory
- Create custom themes in
termsnap.config.ts
You can use any theme from the iTerm2-Color-Schemes VSCode directory. If the theme name is not in the built-in list, termsnap will automatically attempt to download it from the repository:
# Use a remote theme (e.g., 0x96f)
pnpx termsnap "command" --theme "0x96f"
port
- Server port (default: 3000)cdn
- CDN provider for xterm.js (jsdelivr, unpkg)force
- Force to download the theme from remote
screenshot
- Generate screenshot and save to filedpi
- Device pixel ratio for screenshothtml
- Generate HTML template and save to fileopen
- Open browser after generating HTML template
theme
- Terminal theme (vitesse-dark, vitesse-light, catppuccin variants, etc.)colors
- Custom terminal color configurationheight
- Terminal heightwidth
- Terminal width
fontFamily
- Terminal font familyfontSize
- Terminal font sizefontWeight
- Terminal font weightlineHeight
- Terminal line height
borderRadius
- Terminal border radiusborderWidth
- Terminal border widthborderColor
- Terminal border colorboxShadow
- Terminal box shadowpadding
- Terminal paddingmargin
- Terminal margindecoration
- Draw window decorations (minimize, maximize, close buttons)
This project was inspired by:
- termshot - Creates screenshots based on terminal command output
- freeze - Generate images of code and terminal output 📸
I wanted a simple way to create screenshots for my CLI tools to include in README files. However, existing tools had limitations with fonts, emoji support, and interactive terminal sessions. This led me to create termsnap - a terminal screenshot tool that feels like recording your terminal sessions with perfect fidelity.
MIT License © jinghaihan