# RGB 颜色

## 简绍

自从 1.16 Mojang 加入了 RGB 颜色支持，MC 也将允许我们使用 256^3 种不同的颜色而不是支持的 16 种。这也意味着 < 1.16 的版本不支持该功能。

## 用法

支持的 RGB 格式:\
`#RRGGBB`\
`&#RRGGBB`\
`{#RRGGBB}`\
`#<RRGGBB>`\
`&x&R&R&G&G&B&B`

渐变色效果:\
`<#RRGGBB>Text</#RRGGBB>`\
`{#RRGGBB>}Text{#RRGGBB<}`\
`<$#RRGGBB>Text<$#RRGGBB>`\
`<gradient:#RRGGBB:#RRGGBB>Text</gradient>`

TAB 默认使用第一个，但也可以接受其他类型，而不会留下任何字符（例如 {}）。

**不要忘记替换 `RRGGBB` 为实际的十六进制颜色代码，例如 `FFAA00`** (是的，真的有人只是复制 "RRGGBB" 然后问我们为什么RGB颜色没有显示):\
这个颜色代码代表 256 红 170 绿 0 蓝，对应原来的颜色代码 `6` (橙色)。&#x20;

你也可以使用 [该网站](https://htmlcolorcodes.com/) 查找自己喜欢的RGB颜色。

### 格式化代码

和以前的颜色代码一样，在其前后添加即可。例如: `#00FFFF&lText`.

如果是渐变色，你只需要将格式化代码放在文本的最开始的前面即可。例如 `<#00FF00>&lBold gradient text</#FF00FF>`.

## 无效代码解决

如果您不小心使用了无效的十六进制颜色代码，插件将简单地忽略它并将其保持为原始格式。

## 与 <1.16 兼容性

由于 <1.16客户端不能使用这些颜色代码，因此必须显示其他内容。该插件将找该 RGB 颜色最接近的旧版颜色，并将使用该颜色。

### 手动转换

如果你想要指定一个旧版颜色而不是插件自动寻找，你可以通过在颜色代码的末尾添加 `|L` ，其中 `L` 表示旧版颜色代码 (0-9 a-f)。\
例如:\
`#RRGGBB|L`\
`&#RRGGBB|L`\
`{#RRGGBB|L}`\
`#<RRGGBB|L>`\
`<#RRGGBB|L>`\
`&x&R&R&G&G&B&B|L`

对于渐变色，这回导致整个文本被替换为相同的颜色而不是每个字符的最接近旧版颜色。同样，将 `|L` 放置到最开始的颜色代码的末尾位置。\
例如:\
`<#RRGGBB|L>Text</#RRGGBB>`\
`{#RRGGBB|L>}Text{#RRGGBB<}`\
`<$#RRGGBB|L>Text<$#RRGGBB>`\
`<gradient:#RRGGBB|L:#RRGGBB>Text</gradient>`


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.superiormc.cn/tab-wiki/functions/rgb-yan-se.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
