跳至內容

模板:Font color/doc

輕之舟百科,讓知識輕裝啟航
IdleTap-bot​(對話 | 貢獻)2026年8月3日 (一) 08:05的修訂 (导入自求闻百科)
(差異) ←上個修訂 | 最新修訂 (差異) | 下個修訂→ (差異)

模板連結:{{ Font color }} 你可以這樣插入有顏色的文字 紅 橙 綠 藍 靛, 以及 其他。 你也可以通過 background 指定背景色。

模板連結:{{ Font color }} 也可以給維基連結上色。 通常 [[ wikilink ]] → wikilink, 不過我們用 模板連結:{{ font color }} 和 |link = 來創建一個黑紫色的。 →    wikilink    你可以通過 |link= 參數創建到達任何頁面的連結。

這個模板使用 HTML5 語法,為你加入 span 標籤: <span style=color:color>...</span> 和 <span style=background-color:color>...</span>,以增強頁面可讀性。

模板連結:{{Font color}} 有單色和雙色版:

{{font color | 文字顏色 | 文字 }}
{{font color | 文字顏色 | 背景顏色 | 文字 }}.

兩種格式都有一個 |link= 選項,用於給維基連結添加顏色。

|link=yes → [[文字]]
|link=fullpagename → [[页面地址]]

你也可以使用其他參數

{{font color | fg=color | text=text }}
{{font color | fg=文字顏色 | bg=背景顏色 | text=文字 }}

你也可以 |fg= 或者 |bg=,但如果你這麼用了, 就必須使用 |text=。 (參見 Help:Template#Parameters。)

空格不是問題

.{{font color|tan|green|text with four words}}. → .text with four words.
. {{font color|tan|green|text with four words}} . → . text with four words .
. {{ font color | tan | green | text with four words }} . → . text with four words .
Use / description Default value
{{{1}}} 文本顏色 inherited
{{{2}}} 文本
link =yes or =fullpagename
Or
Use / description Default value
{{{1}}} 文本顏色 inherited
{{{2}}} 背景顏色 inherited
{{{3}}} 文字
link =yes or =頁面全名
Markup Renders as
{{ font color | green | green text }} green text
{{ font color | blue | do not style text as a link }} do not style text as a link
{{ font color || yellow | default text in yellow background }} default text in yellow background
{{ font color | bg=yellow | text = default text in yellow background }} default text in yellow background
{{ font color | white | black | white with black background }} white with black background
{{ font color | #ffffff | #000000 | white with black background }} ([[hexadecimal colors]]) white with black background (hexadecimal colors)
Markup Renders as
{{ font color | white | blue | Qiuwen:Example | link = yes }} Qiuwen:Example
{{ font color | white | blue | Qiuwen:Example | link = Qiuwen:Sandbox }} Qiuwen:Example
{{ font color | text = Qiuwen:Example | link = Qiuwen:Sandbox | bg = blue | fg = white }} Qiuwen:Example

The |link= parameter is a good way to colorize wikilinks, and it is about as much typing as the pipe trick.

Although a wikilink accepts a font color (or other template or markup):

[[Qiuwen:Example|{{font color|white|blue|the Qiuwen:Example page}}]]
→ the Qiuwen:Example page (a font-colored link),

a font color does not accept a wikilink, it creates wikilinks itself with |link=.

  • {{ font color | green | violet | Qiuwen:Example | link=yes }} → Qiuwen:Example (a |link= 模板連結:{{ font color }})
  • ☒N{{ font color | green | violet | the [[Qiuwen:Example]] page}} → the Qiuwen:Example page (Text with [[wikilink brackets]] overrides the designated color)
  • ☒N{{ font color | green | violet | [[Qiuwen:Exammple]] }} → the Qiuwen:Exammple page (Text with [[wikilink brackets]] overrides the designated color)

For actual mainspace template usage, here are search links for