From baa944ac736ee70666e221c8cb2ab8fc05e90968 Mon Sep 17 00:00:00 2001
From: wehub-resource-sync
Date: Mon, 13 Jul 2026 10:19:26 +0000
Subject: [PATCH] docs: make Chinese README the default
---
README.md | 186 +++++++++++++++++++++++++++---------------------------
1 file changed, 92 insertions(+), 94 deletions(-)
diff --git a/README.md b/README.md
index ad0ba77..40b369b 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,9 @@
+
+> [!NOTE]
+> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
+> [English](./README.en.md) · [原始项目](https://github.com/charmbracelet/freeze) · [上游 README](https://github.com/charmbracelet/freeze/blob/HEAD/README.md)
+> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
+
# Freeze
@@ -6,17 +12,17 @@
-Generate images of code and terminal output.
+生成代码和终端输出的图片。
-## Examples
+## 示例
-Freeze generates PNGs, SVGs, and WebPs of code and terminal output alike.
+Freeze 可以同样生成代码和终端输出的 PNG、SVG 和 WebP 图片。
-### Generate an image of code
+### 生成代码图片
```sh
freeze artichoke.hs -o artichoke.png
@@ -28,10 +34,9 @@ freeze artichoke.hs -o artichoke.png
-### Generate an image of terminal output
+### 生成终端输出图片
-You can use `freeze` to capture ANSI output of a terminal command with the
-`--execute` flag.
+你可以使用 `freeze` 配合 `--execute` 标志捕获终端命令的 ANSI 输出。
```bash
freeze --execute "eza -lah"
@@ -43,9 +48,9 @@ freeze --execute "eza -lah"
-Freeze is also [super customizable](#customization) and ships with an [interactive TUI](#interactive-mode).
+Freeze 还[高度可定制](#customization),并提供[交互式 TUI](#interactive-mode)。
-## Installation
+## 安装
```sh
# macOS or Linux
@@ -58,12 +63,12 @@ yay -S freeze
nix-env -iA nixpkgs.charm-freeze
```
-Or, download it:
+或者,直接下载:
-- [Packages][releases] are available in Debian and RPM formats
-- [Binaries][releases] are available for Linux, macOS, and Windows
+- [软件包][releases] 提供 Debian 和 RPM 格式
+- [二进制文件][releases] 适用于 Linux、macOS 和 Windows
-Or, just install it with `go`:
+或者,使用 `go` 安装:
```sh
go install github.com/charmbracelet/freeze@latest
@@ -71,11 +76,11 @@ go install github.com/charmbracelet/freeze@latest
[releases]: https://github.com/charmbracelet/freeze/releases
-## Customization
+## 定制
-### Interactive mode
+### 交互模式
-Freeze features a fully interactive mode for easy customization.
+Freeze 提供完整的交互模式,便于轻松定制。
```bash
freeze --interactive
@@ -83,43 +88,41 @@ freeze --interactive
-Settings are written to `$XDG_CONFIG/freeze/user.json` and can be accessed with
-`freeze --config user`.
+设置会写入 `$XDG_CONFIG/freeze/user.json`,可通过 `freeze --config user` 访问。
-### Flags
+### 标志
-Screenshots can be customized with `--flags` or [Configuration](#configuration) files.
+可使用 `--flags` 或[配置文件](#configuration)自定义截图。
> [!NOTE]
-> You can view all freeze customization with `freeze --help`.
+> 可使用 `freeze --help` 查看所有 freeze 定制选项。
-- [`-b`](#background), [`--background`](#background): Apply a background fill.
-- [`-c`](#configuration), [`--config`](#configuration): Base configuration file or template.
-- [`-l`](#language), [`--language`](#language): Language to apply to code
-- [`-m`](#margin), [`--margin`](#margin): Apply margin to the window.
-- [`-o`](#output), [`--output`](#output): Output location for .svg, .png, .jpg.
-- [`-p`](#padding), [`--padding`](#padding): Apply padding to the code.
-- [`-r`](#border-radius), [`--border.radius`](#border-radius): Corner radius of window.
-- [`-t`](#theme), [`--theme`](#theme): Theme to use for syntax highlighting.
-- [`-w`](#window), [`--window`](#window): Display window controls.
-- [`-H`](#height), [`--height`](#height): Height of terminal window.
-- [`--border.width`](#border-width): Border width thickness.
-- [`--border.color`](#border-width): Border color.
-- [`--shadow.blur`](#shadow): Shadow Gaussian Blur.
-- [`--shadow.x`](#shadow): Shadow offset x coordinate.
-- [`--shadow.y`](#shadow): Shadow offset y coordinate.
-- [`--font.family`](#font): Font family to use for code.
-- [`--font.ligatures`](#font): Use ligatures in the font.
-- [`--font.size`](#font): Font size to use for code.
-- [`--font.file`](#font): File path to the font to use (embedded in the SVG).
-- [`--line-height`](#font): Line height relative to font size.
-- [`--show-line-numbers`](#line-numbers): Show line numbers.
-- [`--lines`](#line-numbers): Lines to capture (start,end).
+- [`-b`](#background)、[`--background`](#background):应用背景填充。
+- [`-c`](#configuration)、[`--config`](#configuration):基础配置文件或模板。
+- [`-l`](#language)、[`--language`](#language):应用于代码的语言
+- [`-m`](#margin)、[`--margin`](#margin):为窗口应用外边距。
+- [`-o`](#output)、[`--output`](#output):.svg、.png、.jpg 的输出位置。
+- [`-p`](#padding)、[`--padding`](#padding):为代码应用内边距。
+- [`-r`](#border-radius)、[`--border.radius`](#border-radius):窗口圆角半径。
+- [`-t`](#theme)、[`--theme`](#theme):用于语法高亮的主题。
+- [`-w`](#window)、[`--window`](#window):显示窗口控件。
+- [`-H`](#height)、[`--height`](#height):终端窗口高度。
+- [`--border.width`](#border-width):边框宽度。
+- [`--border.color`](#border-width):边框颜色。
+- [`--shadow.blur`](#shadow):阴影高斯模糊。
+- [`--shadow.x`](#shadow):阴影 x 轴偏移量。
+- [`--shadow.y`](#shadow):阴影 y 轴偏移量。
+- [`--font.family`](#font):代码所用字体族。
+- [`--font.ligatures`](#font):在字体中使用连字(ligatures)。
+- [`--font.size`](#font):代码所用字号。
+- [`--font.file`](#font):所用字体文件路径(嵌入 SVG)。
+- [`--line-height`](#font):相对于字号的行高。
+- [`--show-line-numbers`](#line-numbers):显示行号。
+- [`--lines`](#line-numbers):要捕获的行(起始,结束)。
-### Language
+### 语言
-If possible, `freeze` auto-detects the language from the file name or analyzing
-the file contents. Override this inference with the `--language` flag.
+在可能的情况下,`freeze` 会根据文件名或分析文件内容自动检测语言。使用 `--language` 标志可覆盖此推断。
```bash
cat artichoke.hs | freeze --language haskell
@@ -131,9 +134,9 @@ cat artichoke.hs | freeze --language haskell
-### Theme
+### 主题
-Change the color theme.
+更改颜色主题。
```bash
freeze artichoke.hs --theme dracula
@@ -145,10 +148,9 @@ freeze artichoke.hs --theme dracula
-### Output
+### 输出
-Change the output file location, defaults to `out.svg` or stdout if piped. This
-value supports `.svg`, `.png`, `.webp`.
+更改输出文件位置,默认为 `out.svg`;若通过管道传输则默认为 stdout。该值支持 `.svg`、`.png`、`.webp`。
```bash
freeze main.go --output out.svg
@@ -159,10 +161,9 @@ freeze main.go --output out.webp
freeze main.go --output out.{svg,png,webp}
```
-### Font
+### 字体
-Specify the font family, font size, and font line height of the output image.
-Defaults to `JetBrains Mono`, `14`(px), `1.2`(em).
+指定输出图片的字体族、字号和行高。默认为 `JetBrains Mono`、`14`(px)、`1.2`(em)。
```bash
freeze artichoke.hs \
@@ -171,28 +172,27 @@ freeze artichoke.hs \
--line-height 1.4
```
-You can also embed a font file (in TTF, WOFF, or WOFF2 format) using the
-`--font.file` flag.
+也可使用 `--font.file` 标志嵌入字体文件(TTF、WOFF 或 WOFF2 格式)。
-To use ligatures in the font, you can apply the `--font.ligatures` flag.
+若要在字体中使用连字,可应用 `--font.ligatures` 标志。
-### Line Numbers
+### 行号
-Show line numbers in the terminal window with the `--show-line-numbers` flag.
+使用 `--show-line-numbers` 标志在终端窗口中显示行号。
```bash
freeze artichoke.hs --show-line-numbers
```
-To capture only a specific range of line numbers you can use the `--lines` flag.
+若只捕获特定范围的行号,可使用 `--lines` 标志。
```bash
freeze artichoke.hs --show-line-numbers --lines 2,3
```
-### Border Radius
+### 圆角半径
-Add rounded corners to the terminal.
+为终端添加圆角。
```bash
freeze artichoke.hs --border.radius 8
@@ -204,9 +204,9 @@ freeze artichoke.hs --border.radius 8
-### Window
+### 窗口
-Add window controls to the terminal, macOS-style.
+为终端添加 macOS 风格的窗口控件。
```bash
freeze artichoke.hs --window
@@ -216,25 +216,25 @@ freeze artichoke.hs --window
-### Background
+### 背景
-Set the background color of the terminal window.
+设置终端窗口的背景颜色。
```bash
freeze artichoke.hs --background "#08163f"
```
-### Height
+### 高度
-Set the height of the terminal window.
+设置终端窗口的高度。
```bash
freeze artichoke.hs --height 400
```
-### Border Width
+### 边框宽度
-Add a border outline to the terminal window.
+为终端窗口添加边框轮廓。
```bash
freeze artichoke.hs --border.width 1 --border.color "#515151" --border.radius 8
@@ -246,9 +246,9 @@ freeze artichoke.hs --border.width 1 --border.color "#515151" --border.radius 8
-### Padding
+### 内边距
-Add padding to the terminal window. You can provide 1, 2, or 4 values.
+为终端窗口添加内边距。可提供 1、2 或 4 个值。
```bash
freeze main.go --padding 20 # all sides
@@ -262,9 +262,9 @@ freeze main.go --padding 20,60,20,40 # top, right, bottom, left
-### Margin
+### 外边距
-Add margin to the terminal window. You can provide 1, 2, or 4 values.
+为终端窗口添加外边距。可提供 1、2 或 4 个值。
```bash
freeze main.go --margin 20 # all sides
@@ -275,12 +275,12 @@ freeze main.go --margin 20,60,20,40 # top, right, bottom, left
-
+
### Shadow
-Add a shadow under the terminal window.
+在终端窗口下方添加阴影。
```bash
freeze artichoke.hs --shadow.blur 20 --shadow.x 0 --shadow.y 10
@@ -289,38 +289,36 @@ freeze artichoke.hs --shadow.blur 20 --shadow.x 0 --shadow.y 10
-
+
## Screenshot TUIs
-Use `tmux capture-pane` to generate screenshots of TUIs.
+使用 `tmux capture-pane` 为 TUI(Terminal User Interface,终端用户界面)生成截图。
-Run your TUI in `tmux` and get it to the state you want to capture.
-Next, use `capture-pane` to capture the pane and pipe that to freeze.
+在 `tmux` 中运行你的 TUI,并将其调整到你想捕获的状态。
+接下来,使用 `capture-pane` 捕获该窗格,并将其管道输出到 freeze。
```bash
hx # in a separate pane
tmux capture-pane -pet 1 | freeze -c full
```
-
+
## Configuration
-Freeze also supports configuration via a JSON file which can be passed with the
-`--config` / `-c` flag. In general, all `--flag` options map directly to keys
-and values in the config file
+Freeze 还支持通过 JSON 文件进行配置,可使用
+`--config` / `-c` 标志传入。一般而言,所有 `--flag` 选项都会直接映射到配置文件中的键和值。
-There are also some default configurations built into `freeze` which can be passed by name.
+`freeze` 中还内置了一些默认配置,可按名称传入。
-- `base`: Simple screenshot of code.
-- `full`: macOS-like screenshot.
-- `user`: Uses `~/.config/freeze/user.json`.
+- `base`:简单的代码截图。
+- `full`:类似 macOS 的截图。
+- `user`:使用 `~/.config/freeze/user.json`。
-If you use `--interactive` mode, a configuration file will be created for you at
-`~/.config/freeze/user.json`. This will be the default configuration file used
-in your screenshots.
+如果你使用 `--interactive` 模式,系统会在
+`~/.config/freeze/user.json` 为你创建一份配置文件。这将是你的截图默认使用的配置文件。
```bash
freeze -c base main.go
@@ -329,7 +327,7 @@ freeze -c user main.go # alias for ~/.config/freeze/user.json
freeze -c ./custom.json main.go
```
-Here's what an example configuration looks like:
+下面是一个配置示例:
```json
{
@@ -352,13 +350,13 @@ Here's what an example configuration looks like:
## Contributing
-See [contributing][contribute].
+请参阅 [contributing][contribute]。
[contribute]: https://github.com/charmbracelet/freeze/contribute
## Feedback
-We’d love to hear your thoughts on this project. Feel free to drop us a note!
+我们非常乐意听取你对本项目的想法。欢迎随时给我们留言!
- [Twitter](https://twitter.com/charmcli)
- [The Fediverse](https://mastodon.social/@charmcli)