豐富的文字標記

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

UI rich text 使用簡單的標記標籤來格式化字串在粗體、標號、下線、填色、線條變化和更多方面。您可以應用標記標籤到 TextLabelTextButtonTextBox 對象。

啟用強化文字

您必須通過其 RichText 屬性在 屬性 窗口中啟用強化文字,或將屬性設置為 trueLocalScript 中。


local title = Instance.new("TextLabel")
title.RichText = true
title.Text = "Use a <b>bold title</b>"

支援的標籤

豐富的文字標籤與XML/HTML標籤相似,您必須在格式化的文字中包含開始和關閉標籤。

<b>Formatted text</b>

您也可以在標籤之間巧妙地重疊,以反向順序關閉它們。

<b><i><u>Formatted text</u></i></b>

顏色

<font color=""> </font>

I want the <font color="#FF7800">orange</font> candy.``I want the <font color="rgb(255,125,0)">orange</font> candy.

大小

<font size=""> </font>

<font size="40">This is big.</font> <font size="20">This is small.</font>

字體面

<font face=""> </font>

<font face="Michroma">This is Michroma face.</font>

字體家族

<font family=""> </font>

<font family="rbxasset://fonts/families/Michroma.json">This is Michroma face.</font>

字體重量

<font weight=""> </font>

This is normal. <font weight="heavy">This is heavy.</font>``This is normal. <font weight="900">This is heavy.</font>

條紋

<stroke> </stroke>

You won <stroke color="#00A2FF" joins="miter" thickness="2" transparency="0.25">25 gems</stroke>.

透明度

<font transparency=""> </font>

Text at <font transparency="0.5">50% transparency</font>.

大膽

<b> </b>

Text in <b>bold</b>.

義大利文

<i> </i>

Text <i>italicized</i>.

標記

<u> </u>

Text <u>underlined</u>.

斯特里克斯通

Text with strikethrough

線斷

<br />

New line occurs after this sentence.<br />Next sentence...

大小寫

<uppercase> </uppercase>``<uc> </uc>

<uppercase>Uppercase</uppercase> makes words read loudly! <uc>Uppercase</uc> makes words read loudly!

小帽子

<smallcaps> </smallcaps>``<sc> </sc>

My name is <smallcaps>Diva Dragonslayer</smallcaps>.``My name is <sc>Diva Dragonslayer</sc>.

標記

<mark> </mark>

Text <mark color="#009966" transparency="0">highlighted</mark>.

評論

<!-- -->

After this is a comment...<!--This does not appear in the final text--> and now more text...

逃脫表格

如果您想要渲染某些角色,例如 <> 並將其從考慮作為 rich text 標籤的一部分,您可以在其 scape 形式 中寫下它們。

Personagem逃脱ExemploResultado
<) &lt;10 &lt; 10010 < 100
> &gt;&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;1&lt;100 &gt; 10100 > 10
"título de exemplo" &quot;Meet &quot;Diva Dragonslayer&quot;Conheça "Diva Dragonslayer"
&apos;Diva&apos;s pet is a falcon!Animal de estimação da Diva é um falcão!
&amp;Render another escape form <b>&amp;lt;</b> by escaping an ampersandRender outro formulário de fuga &lt; ao escapar de um ampersand