Termshot: Turn Your Terminal Sessions into Beautiful Screenshots
Ever wanted to share a quick terminal demo without the hassle of recording a video or pasting raw text? Or maybe you need a clean screenshot for a blog post, presentation, or bug report? That’s where Termshot comes in.
It’s a simple CLI tool that captures your terminal output and generates a styled screenshot. No more fiddling with cropping, fonts, or background colors. Just run a command and get a shareable image that actually looks good.
What It Does
Termshot takes a shell command, executes it, and then renders the output as a clean PNG screenshot. It uses a headless browser (Chrome/Chromium in headless mode) behind the scenes to emulate a terminal window with a nice retro aesthetic.
You can choose from a few built-in themes (like “monokai” or “simple”) or create your own. The output is a pixel-perfect image that includes the terminal frame, the command prompt, and the result.
Why It’s Cool
- No manual setup — no need to adjust your own terminal theme, resize a window, or take a screenshot with your OS tools.
- Consistent output — everyone sees the same thing, regardless of their local terminal configuration.
- Lightweight and scriptable — great for embedding in docs, READMEs, or sharing command results in PRs.
- Customizable — you can tweak the background, font, and prompt to match your brand or style.
- It’s fast — runs in a few seconds, even for complex commands.
A clever implementation detail: Termshot actually renders the text inside a real HTML page styled to look like a terminal, then uses Puppeteer (the headless browser library) to capture it. That means true font rendering, antialiasing, and proper line spacing — no pixel snapping or character clipping.
How to Try It
Installation is straightforward via go install (since it’s written in Go):
go install github.com/homeport/termshot/cmd/termshot@latest
Then run:
termshot ls -la
This will create a file like ls -la.png in your current directory. You can also pipe output or use --theme to switch looks.
For a full list of options:
termshot --help
Want to see it in action? The GitHub repo has a few example images.
Final Thoughts
Termshot is one of those tools you didn’t know you needed until you use it. It’s perfect for developers writing documentation, sharing terminal tricks on Twitter, or just making your CLI output look a little less “screenshot of a dark rectangle with text.”
Give it a try the next time you need to show a git log, a curl response, or a docker ps — you’ll wonder why you didn’t have this before.
Follow @githubprojects for more developer tools and open source highlights.
Repository: https://github.com/homeport/termshot