{"id":13471344,"url":"https://github.com/charmbracelet/freeze","last_synced_at":"2025-05-13T22:12:22.075Z","repository":{"id":229829327,"uuid":"741230168","full_name":"charmbracelet/freeze","owner":"charmbracelet","description":"Generate images of code and terminal output 📸","archived":false,"fork":false,"pushed_at":"2025-04-28T12:23:33.000Z","size":5130,"stargazers_count":3795,"open_issues_count":56,"forks_count":65,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-30T12:16:59.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charmbracelet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-10T00:51:47.000Z","updated_at":"2025-04-30T04:06:12.000Z","dependencies_parsed_at":"2024-04-05T09:36:29.804Z","dependency_job_id":"ef2d4487-1a97-4029-a509-bcd6f96395d6","html_url":"https://github.com/charmbracelet/freeze","commit_stats":{"total_commits":339,"total_committers":12,"mean_commits":28.25,"dds":"0.15929203539823011","last_synced_commit":"ead86fae6ca23e6f00dad181d7f4e9015584da2d"},"previous_names":["charmbracelet/freeze"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmbracelet%2Ffreeze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmbracelet%2Ffreeze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmbracelet%2Ffreeze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmbracelet%2Ffreeze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charmbracelet","download_url":"https://codeload.github.com/charmbracelet/freeze/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036843,"owners_count":22003654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:00:43.347Z","updated_at":"2025-05-13T22:12:17.066Z","avatar_url":"https://github.com/charmbracelet.png","language":"Go","funding_links":[],"categories":["Go","Images","Styling \u0026 Output","Command Line Tools","Media","\u003ca name=\"Go\"\u003e\u003c/a\u003eGo"],"sub_categories":["Emoji","Other"],"readme":"# Freeze\n\n\u003cp\u003e\n  \u003ca href=\"https://stuff.charm.sh/freeze/freeze-4k.png\"\u003e\u003cimg src=\"https://github.com/charmbracelet/freeze/assets/25087/de76b799-fa67-4b5b-8da2-d990ca5b4e06\" width=\"500\" /\u003e\u003c/a\u003e\u003cbr\u003e\n  \u003ca href=\"https://github.com/charmbracelet/freeze/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/charmbracelet/freeze.svg\" alt=\"Latest Release\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/charmbracelet/freeze/actions\"\u003e\u003cimg src=\"https://github.com/charmbracelet/freeze/workflows/build/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nGenerate images of code and terminal output.\n\n\u003cp align=\"left\"\u003e\n  \u003ca\u003e\u003cimg width=\"600\" src=\"https://vhs.charm.sh/vhs-1C6z5SUKlTdqdj4KL1ADlH.gif\" alt=\"Freeze code screenshot\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Examples\n\nFreeze generates PNGs, SVGs, and WebPs of code and terminal output alike.\n\n### Generate an image of code\n\n```sh\nfreeze artichoke.hs -o artichoke.png\n```\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/f15efdda-8e9b-4cb1-9e87-3d32b692eb7c\"\u003e\n    \u003cimg alt=\"output of freeze command, Haskell code block\" src=\"./test/golden/svg/shadow.svg\" width=\"800\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n### Generate an image of terminal output\n\nYou can use `freeze` to capture ANSI output of a terminal command with the\n`--execute` flag.\n\n```bash\nfreeze --execute \"eza -lah\"\n```\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/aa5447ed-999a-4809-909d-67093d758f5a\"\u003e\n    \u003cimg alt=\"output of freeze command, ANSI\" src=\"./test/golden/svg/eza.svg\" width=\"800\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nFreeze is also [super customizable](#customization) and ships with an [interactive TUI](#interactive-mode).\n\n## Installation\n\n```sh\n# macOS or Linux\nbrew install charmbracelet/tap/freeze\n\n# Arch Linux (btw)\nyay -S freeze\n\n# Nix\nnix-env -iA nixpkgs.charm-freeze\n```\n\nOr, download it:\n\n- [Packages][releases] are available in Debian and RPM formats\n- [Binaries][releases] are available for Linux, macOS, and Windows\n\nOr, just install it with `go`:\n\n```sh\ngo install github.com/charmbracelet/freeze@latest\n```\n\n[releases]: https://github.com/charmbracelet/freeze/releases\n\n## Customization\n\n### Interactive mode\n\nFreeze features a fully interactive mode for easy customization.\n\n```bash\nfreeze --interactive\n```\n\n\u003cimg alt=\"freeze interactive mode\" src=\"https://vhs.charm.sh/vhs-1AGhIlc2Mtn9Ltc8vPtaAP.gif\" width=\"400\" /\u003e\n\nSettings are written to `$XDG_CONFIG/freeze/user.json` and can be accessed with\n`freeze --config user`.\n\n### Flags\n\nScreenshots can be customized with `--flags` or [Configuration](#configuration) files.\n\n\u003e [!NOTE]\n\u003e You can view all freeze customization with `freeze --help`.\n\n- [`-b`](#background), [`--background`](#background): Apply a background fill.\n- [`-c`](#configuration), [`--config`](#configuration): Base configuration file or template.\n- [`-l`](#language), [`--language`](#language): Language to apply to code\n- [`-m`](#margin), [`--margin`](#margin): Apply margin to the window.\n- [`-o`](#output), [`--output`](#output): Output location for .svg, .png, .jpg.\n- [`-p`](#padding), [`--padding`](#padding): Apply padding to the code.\n- [`-r`](#border-radius), [`--border.radius`](#border-radius): Corner radius of window.\n- [`-t`](#theme), [`--theme`](#theme): Theme to use for syntax highlighting.\n- [`-w`](#window), [`--window`](#window): Display window controls.\n- [`-H`](#height), [`--height`](#height): Height of terminal window.\n- [`--border.width`](#border-width): Border width thickness.\n- [`--border.color`](#border-width): Border color.\n- [`--shadow.blur`](#shadow): Shadow Gaussian Blur.\n- [`--shadow.x`](#shadow): Shadow offset x coordinate.\n- [`--shadow.y`](#shadow): Shadow offset y coordinate.\n- [`--font.family`](#font): Font family to use for code.\n- [`--font.ligatures`](#font): Use ligatures in the font.\n- [`--font.size`](#font): Font size to use for code.\n- [`--font.file`](#font): File path to the font to use (embedded in the SVG).\n- [`--line-height`](#font): Line height relative to font size.\n- [`--show-line-numbers`](#line-numbers): Show line numbers.\n- [`--lines`](#line-numbers): Lines to capture (start,end).\n\n### Language\n\nIf possible, `freeze` auto-detects the language from the file name or analyzing\nthe file contents. Override this inference with the `--language` flag.\n\n```bash\ncat artichoke.hs | freeze --language haskell\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/d746f028-3d51-4bfd-ba81-94bbc47b3587\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block\" src=\"./test/golden/svg/haskell.svg\" width=\"600\" /\u003e\n\u003c/a\u003e\n\n### Theme\n\nChange the color theme.\n\n```bash\nfreeze artichoke.hs --theme dracula\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/c693dc80-89b8-43c6-a34e-2d49a332d0c7\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block with dracula theme\" src=\"./test/golden/svg/dracula.svg\" width=\"600\" /\u003e\n\u003c/a\u003e\n\n### Output\n\nChange the output file location, defaults to `out.svg` or stdout if piped. This\nvalue supports `.svg`, `.png`, `.webp`.\n\n```bash\nfreeze main.go --output out.svg\nfreeze main.go --output out.png\nfreeze main.go --output out.webp\n\n# or all of the above\nfreeze main.go --output out.{svg,png,webp}\n```\n\n### Font\n\nSpecify the font family, font size, and font line height of the output image.\nDefaults to `JetBrains Mono`, `14`(px), `1.2`(em).\n\n```bash\nfreeze artichoke.hs \\\n  --font.family \"SF Mono\" \\\n  --font.size 16 \\\n  --line-height 1.4\n```\n\nYou can also embed a font file (in TTF, WOFF, or WOFF2 format) using the\n`--font.file` flag.\n\nTo use ligatures in the font, you can apply the `--font.ligatures` flag.\n\n### Line Numbers\n\nShow line numbers in the terminal window with the `--show-line-numbers` flag.\n\n```bash\nfreeze artichoke.hs --show-line-numbers\n```\n\nTo capture only a specific range of line numbers you can use the `--lines` flag.\n\n```bash\nfreeze artichoke.hs --show-line-numbers --lines 2,3\n```\n\n### Border Radius\n\nAdd rounded corners to the terminal.\n\n```bash\nfreeze artichoke.hs --border.radius 8\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/50932b10-56fd-4312-adbd-f64b36a15441\"\u003e\n  \u003cimg alt=\"code screenshot with corner radius of 8px\" src=\"./test/golden/svg/border-radius.svg\" width=\"600\" /\u003e\n\u003c/a\u003e\n\n### Window\n\nAdd window controls to the terminal, macOS-style.\n\n```bash\nfreeze artichoke.hs --window\n```\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/ba46bc4a-fb36-4718-88d4-f63b93343615\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block with window controls applied\" src=\"./test/golden/svg/window.svg\" width=\"600\" /\u003e\n\u003c/a\u003e\n\n### Background\n\nSet the background color of the terminal window.\n\n```bash\nfreeze artichoke.hs --background \"#08163f\"\n```\n\n### Height\n\nSet the height of the terminal window.\n\n```bash\nfreeze artichoke.hs --height 400\n```\n\n### Border Width\n\nAdd a border outline to the terminal window.\n\n```bash\nfreeze artichoke.hs --border.width 1 --border.color \"#515151\" --border.radius 8\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/b9207976-50fe-479b-974b-e1bf2ad1684c\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block with border applied\" src=\"./test/golden/svg/border-width.svg\" width=\"600\" /\u003e\n\u003c/a\u003e\n\n### Padding\n\nAdd padding to the terminal window. You can provide 1, 2, or 4 values.\n\n```bash\nfreeze main.go --padding 20          # all sides\nfreeze main.go --padding 20,40       # vertical, horizontal\nfreeze main.go --padding 20,60,20,40 # top, right, bottom, left\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/41da80bb-a6d8-402b-9f14-c73050720c0f\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block with padding applied\" src=\"./test/golden/svg/padding.svg\" width=\"600\" /\u003e\n\u003c/a\u003e\n\n### Margin\n\nAdd margin to the terminal window. You can provide 1, 2, or 4 values.\n\n```bash\nfreeze main.go --margin 20          # all sides\nfreeze main.go --margin 20,40       # vertical, horizontal\nfreeze main.go --margin 20,60,20,40 # top, right, bottom, left\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/eca78a8e-2dbc-4cfa-81da-6c2194925238\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block with margin applied\" src=\"./test/golden/svg/margin.svg\" width=\"720\" /\u003e\n\u003c/a\u003e\n\n### Shadow\n\nAdd a shadow under the terminal window.\n\n```bash\nfreeze artichoke.hs --shadow.blur 20 --shadow.x 0 --shadow.y 10\n```\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://github.com/charmbracelet/freeze/assets/42545625/b9a8cc17-5ec6-4004-941b-5ae1b65d2b18\"\u003e\n  \u003cimg alt=\"output of freeze command, Haskell code block with a shadow\" src=\"./test/golden/svg/shadow.svg\" width=\"720\" /\u003e\n\u003c/a\u003e\n\n## Screenshot TUIs\n\nUse `tmux capture-pane` to generate screenshots of TUIs.\n\nRun your TUI in `tmux` and get it to the state you want to capture.\nNext, use `capture-pane` to capture the pane and pipe that to freeze.\n\n```bash\nhx # in a separate pane\ntmux capture-pane -pet 1 | freeze -c full\n```\n\n\u003cimg width=\"650px\" src=\"./test/golden/svg/helix.svg\" alt=\"helix captured with freeze\"\u003e\n\n## Configuration\n\nFreeze also supports configuration via a JSON file which can be passed with the\n`--config` / `-c` flag. In general, all `--flag` options map directly to keys\nand values in the config file\n\nThere are also some default configurations built into `freeze` which can be passed by name.\n\n- `base`: Simple screenshot of code.\n- `full`: macOS-like screenshot.\n- `user`: Uses `~/.config/freeze/user.json`.\n\nIf you use `--interactive` mode, a configuration file will be created for you at\n`~/.config/freeze/user.json`. This will be the default configuration file used\nin your screenshots.\n\n```bash\nfreeze -c base main.go\nfreeze -c full main.go\nfreeze -c user main.go # alias for ~/.config/freeze/user.json\nfreeze -c ./custom.json main.go\n```\n\nHere's what an example configuration looks like:\n\n```json\n{\n  \"window\": false,\n  \"border\": {\n    \"radius\": 0,\n    \"width\": 0,\n    \"color\": \"#515151\"\n  },\n  \"shadow\": false,\n  \"padding\": [20, 40, 20, 20],\n  \"margin\": \"0\",\n  \"font\": {\n    \"family\": \"JetBrains Mono\",\n    \"size\": 14\n  },\n  \"line_height\": 1.2\n}\n```\n\n## Contributing\n\nSee [contributing][contribute].\n\n[contribute]: https://github.com/charmbracelet/freeze/contribute\n\n## Feedback\n\nWe’d love to hear your thoughts on this project. Feel free to drop us a note!\n\n- [Twitter](https://twitter.com/charmcli)\n- [The Fediverse](https://mastodon.social/@charmcli)\n- [Discord](https://charm.sh/chat)\n\n## License\n\n[MIT](https://github.com/charmbracelet/freeze/raw/main/LICENSE)\n\n---\n\nPart of [Charm](https://charm.sh).\n\n\u003ca href=\"https://charm.sh/\"\u003e\n  \u003cimg\n    alt=\"The Charm logo\"\n    width=\"400\"\n    src=\"https://stuff.charm.sh/charm-badge.jpg\"\n  /\u003e\n\u003c/a\u003e\n\nCharm热爱开源 • Charm loves open source\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharmbracelet%2Ffreeze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharmbracelet%2Ffreeze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharmbracelet%2Ffreeze/lists"}