模板:Font color

模板页面

文档图示 模板文档[查看] [编辑] [查看历史] [清除缓存]

用途

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

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

这个模板使用最新的 Qiuwen:HTML5 语法,Template: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 .

参数

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 more examples see /testcases. For actual mainspace template usage, here are search links for

参见

上述文档内容嵌入自Template:Font color/doc编辑 | 历史
编者可以在本模板的沙盒创建 | 镜像和测试样例创建页面进行实验。
请将模板自身所属的分类添加在文档中。本模板的子页面