> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/appendixes/color/color-which.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# N.2. 設定色彩 \#

### N.2. 設定色彩 [#](#color-which) <a href="#color-which" id="color-which"></a>

實際要使用的色彩由環境變數 `PG_COLORS`（注意是複數）設定。其值為以冒號分隔的 `key=value` 配對清單。鍵指定色彩的用途；值則是由終端機解譯的 SGR（Select Graphic Rendition）規格。

目前使用下列鍵：

`error` : 用於醒目顯示錯誤訊息中的「error」文字

`warning` : 用於醒目顯示警告訊息中的「warning」文字

`note` : 用於醒目顯示此類訊息中的「detail」與「hint」文字

`locus` : 用於醒目顯示訊息中的位置資訊（例如程式名稱與檔案名稱）

預設值為 `error=01;31:warning=01;35:note=01;36:locus=01`（`01;31` 代表粗體紅色，`01;35` 代表粗體洋紅色，`01;36` 代表粗體青色，`01` 代表粗體的預設色彩）。

#### 提示

GCC、GNU coreutils 與 GNU grep 等其他軟體套件也使用此色彩規格格式。

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/color-which.html)（原文版本：18.6；核對日期：2026-09-06）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/appendixes/color/color-which.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
