模板:Font color

来自Age Of History 2 Chinese Wiki
Obtusecat留言 | 贡献2025年7月3日 (四) 15:46的版本 (创建页面,内容为“{{ {{{|safesubst:}}}#if: {{{text|{{{3|}}}}}} | {{ {{{|safesubst:}}}#if: {{{link|}}} | {{ {{{|safesubst:}}}#ifeq: {{{link|}}} | yes | [[ {{ {{{|safesubst:}}}trim | {{{text|{{{3|}}}}}} }}|<span class=skin-invert style="background-color:{{ {{{|safesubst:}}}trim | {{{bg|{{{2|inherit}}}}}} }}; color:{{ {{{|safesubst:}}}trim | {{{fg|{{{1|inherit}}}}}} }};">{{ {{{|safesubst:}}}trim | {{{text|{{{3|}}}}}} }}</span>]] | {{{link|}}}|<span class=skin-i…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至:导航、​搜索
0.00
(0票)

模板文档  [查看] [编辑] [历史] [刷新]

模板:Warning

用途

{{Font color}} 你可以这样插入有颜色的文字 绿 , 以及 其他。 你也可以通过 background指定背景色。

{{Font color}} 也可以给维基链接上色。 通常 [[ wikilink ]]wikilink, 不过我们用 {{ font color }} 和 |link = 来创建一个黑紫色的。 →    wikilink    你可以通过 |link= 参数创建到达任何页面的链接。

这个模板使用最新的 HTML5 语法,模板:Clarify timeframe/sandbox 为你加入 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 .

参数

模板:Aligned table

Or

模板:Aligned table

样例

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模板:Bigyellow | default text in yellow background }} default text in yellow background
{{ font color模板:Bigbg=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 | Wikipedia:Example | link = yes }} Wikipedia:Example
{{ font color | white | blue | Wikipedia:Example | link = Wikipedia:Sandbox }} Wikipedia:Example
{{ font color | text = Wikipedia:Example | link = Wikipedia:Sandbox | bg = blue | fg = white }} Wikipedia: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):

模板:BigWikipedia:Example模板:Big{{font color|white|blue|the Wikipedia:Example page}}模板:Big
the Wikipedia:Example page (a font-colored link),

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

For more examples see /testcases. For actual mainspace template usage, here are search links for

参见

Loading comments...