How to use Freeze to Capture and Customize Your Code Screenshots

No more ugly screenshots that no one wants to look at. With Freeze, you can customize your code screenshots like never before.

You can install it with Homebrew on macOS or Linux, or even with a good old go install if you’re old school. Once that’s done, you just run:

freeze mycode.js -o code.png

in your terminal, and voilà, your screenshot will be there, fresh and sharp.

You can even capture the result of commands with the –execute parameter:

freeze --execute "eza -lah"

The great thing about Freeze is that it allows you to choose a theme to personalize the look of your code. A simple –theme dracula and you’ll have code with the colors of the famous vampire. Need to add window controls in macOS style? –window and you’re done. And how about the possibility of adding a shadow, rounded corners, or even integrating your own font? The Freeze developers have thought of everything…

And if you like tinkering, you’ll love Freeze’s interactive mode. Just run:

freeze --interactive

and you can customize your screenshot live, like a true pro.

It’s also a real time-saver for developers who want to make pieces of code presentable for inclusion in documentation or a website. Let me give you a little example. Let’s say you want to capture a piece of JavaScript code with the Dracula theme, a nice window, a shadow, and rounded corners.

Here’s what it looks like:

freeze mycode.js --theme dracula --window --shadow.blur 20 --shadow.x 0 --shadow.y 10 --border.radius

Thus, with a single command line, you get a professional-looking code image. Plus, the advantage is that it can be automated.

Anyway, I think you get the idea. If you’re interested, head over to https://github.com/charmbracelet/freeze.

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1747

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *