Plantilla:Font color/doc
Plantilla:Documentation subpage Plantilla:Warning
Purpose
Plantilla:Tl is how you insert colorized text, such as {{ safesubst:#if:
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]]
| [[|{{ safesubst:#if:1| }}]]
}}
| {{ safesubst:#if:1| }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| red }} |{{ safesubst:#if:1| red }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| red }}]]
}}
| {{ safesubst:#if:1| red }}
}}
}}, {{ safesubst:#if:
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]]
| [[|{{ safesubst:#if:1| }}]]
}}
| {{ safesubst:#if:1| }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| orange }} |{{ safesubst:#if:1| orange }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| orange }}]]
}}
| {{ safesubst:#if:1| orange }}
}}
}}, {{ safesubst:#if:
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]]
| [[|{{ safesubst:#if:1| }}]]
}}
| {{ safesubst:#if:1| }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| green }} |{{ safesubst:#if:1| green }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| green }}]]
}}
| {{ safesubst:#if:1| green }}
}}
}}, {{ safesubst:#if:
| {{ safesubst:#if: cat
| {{ safesubst:#ifeq: cat | yes
| [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]]
| {{ safesubst:#if:1| }}
}}
| {{ safesubst:#if:1| }}
}}
| {{ safesubst:#if: cat
| {{ safesubst:#ifeq: cat | yes
| [[ {{ safesubst:#if:1| blue }} |{{ safesubst:#if:1| blue }}]]
| [[ {{ safesubst:#if:1| cat }} |{{ safesubst:#if:1| blue }}]]
}}
| {{ safesubst:#if:1| blue }}
}}
}} and {{ safesubst:#if:
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]]
| [[|{{ safesubst:#if:1| }}]]
}}
| {{ safesubst:#if:1| }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| indigo }} |{{ safesubst:#if:1| indigo }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| indigo }}]]
}}
| {{ safesubst:#if:1| indigo }}
}}
}}, and many others. You can specify its {{ safesubst:#if: background
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| background }}|{{ safesubst:#if:1| background }}]]
| [[|{{ safesubst:#if:1| background }}]]
}}
| {{ safesubst:#if:1| background }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| yellow }} |{{ safesubst:#if:1| yellow }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| yellow }}]]
}}
| {{ safesubst:#if:1| yellow }}
}}
}} color at the same time.
Plantilla:Tl is also how you can color wikilinks to something other than blue for when you need to work within background colors. Normally [[ wikilink ]] → wikilink, but here we use a Plantilla:Tl with Plantilla:Para to create a black wikilink → {{ safesubst:#if: wikilink
| {{ safesubst:#if: yes
| {{ safesubst:#ifeq: yes | yes
| [[ {{ safesubst:#if:1| wikilink }}|{{ safesubst:#if:1| wikilink }}]]
| {{ safesubst:#if:1| wikilink }}
}}
| {{ safesubst:#if:1| wikilink }}
}}
| {{ safesubst:#if: yes
| {{ safesubst:#ifeq: yes | yes
| [[ {{ safesubst:#if:1| violet }} |{{ safesubst:#if:1| violet }}]]
| [[ {{ safesubst:#if:1| yes }} |{{ safesubst:#if:1| violet }}]]
}}
| {{ safesubst:#if:1| violet }}
}}
}} You can make any text link to any page using the Plantilla:Para parameter.
This template will use the latest Wikipedia:HTML5 recommendations, inserting the span tags Plantilla:Tag and Plantilla:Tag for you, so your page increases its readability and usability in both the wikitext and the rendered page.
Usage
Plantilla:Tlf has a one-color and a two-color form:
- {{font color | color | text }}
- {{font color | text color | background color | text }}.
Either form has a |link= option, for colorizing (otherwise blue or red) wikilink text.
- |link=yes →
[[text]] - |link=fullpagename →
[[fullpagename]]
You can also name the other fields.
- {{font color | fg=color | text=text }}
- {{font color | fg=text color | bg=background color | text=text }}
You can name |fg= or |bg=, which is nice, but... if you name either of them, you must also name |text=, which is a compromise. (See Help:Template#Parameters for why.)
Spacing is of no concern.
.{{font color|tan|green|text with four words}}.→.{{ safesubst:#if: text with four words
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| text with four words }}|{{ safesubst:#if:1| text with four words }}]]
| [[|{{ safesubst:#if:1| text with four words }}]]
}}
| {{ safesubst:#if:1| text with four words }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| green }} |{{ safesubst:#if:1| green }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| green }}]]
}}
| {{ safesubst:#if:1| green }}
}}
}}.
.{{font color|tan|green|text with four words}}.→.{{ safesubst:#if: text with four words
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| text with four words }}|{{ safesubst:#if:1| text with four words }}]]
| [[|{{ safesubst:#if:1| text with four words }}]]
}}
| {{ safesubst:#if:1| text with four words }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| green }} |{{ safesubst:#if:1| green }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| green }}]]
}}
| {{ safesubst:#if:1| green }}
}}
}} .
.{{ font color | tan | green | text with four words }}.→.{{ safesubst:#if: text with four words
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| text with four words }}|{{ safesubst:#if:1| text with four words }}]]
| [[|{{ safesubst:#if:1| text with four words }}]]
}}
| {{ safesubst:#if:1| text with four words }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| green }} |{{ safesubst:#if:1| green }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| green }}]]
}}
| {{ safesubst:#if:1| green }}
}}
}} .
Parameters
- Or
Examples
| Markup | Renders as | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
{{ font color | green | green text }}
|
{{ safesubst:#if: | {{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]] | [[|{{ safesubst:#if:1| }}]]
}} |
}}
}} |
{{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| green text }} |{{ safesubst:#if:1| green text }}]] | [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| green text }}]]
}} |
green text }}
}} }} |
{{ font color | blue | do not style text as a link }}
|
{{ safesubst:#if: | {{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| }}|{{ safesubst:#if:1| }}]] | [[|{{ safesubst:#if:1| }}]]
}} |
}}
}} |
{{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| do not style text as a link }} |{{ safesubst:#if:1| do not style text as a link }}]] | [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| do not style text as a link }}]]
}} |
do not style text as a link }}
}} }} |
{{ font color | white | black | white with black background }}
|
{{ safesubst:#if: white with black background | {{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| white with black background }}|{{ safesubst:#if:1| white with black background }}]] | [[|{{ safesubst:#if:1| white with black background }}]]
}} |
white with black background }}
}} |
{{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| black }} |{{ safesubst:#if:1| black }}]] | [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| black }}]]
}} |
black }}
}} }} |
{{ font colorPlantilla:Bigyellow | default text in yellow background }}
|
{{ safesubst:#if: default text in yellow background | {{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| default text in yellow background }}|{{ safesubst:#if:1| default text in yellow background }}]] | [[|{{ safesubst:#if:1| default text in yellow background }}]]
}} |
default text in yellow background }}
}} |
{{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| yellow }} |{{ safesubst:#if:1| yellow }}]] | [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| yellow }}]]
}} |
yellow }}
}} }} |
{{ font colorPlantilla:Bigbg=yellow | text = default text in yellow background }}
|
{{ safesubst:#if: default text in yellow background | {{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| default text in yellow background }}|{{ safesubst:#if:1| default text in yellow background }}]] | [[|{{ safesubst:#if:1| default text in yellow background }}]]
}} |
default text in yellow background }}
}} |
{{ safesubst:#if: | yes | [[ {{ safesubst:#if:1| yellow }} |{{ safesubst:#if:1| yellow }}]] | [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| yellow }}]]
}} |
yellow }}
}} }} |
| Markup | Renders as | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
{{ font color | white | blue | Wikipedia:Example | link = yes }}
|
{{ safesubst:#if: Wikipedia:Example | {{ safesubst:#if: yes | yes | [[ {{ safesubst:#if:1| Wikipedia:Example }}|{{ safesubst:#if:1| Wikipedia:Example }}]] | {{ safesubst:#if:1| Wikipedia:Example }}
}} |
Wikipedia:Example }}
}} |
{{ safesubst:#if: yes | yes | [[ {{ safesubst:#if:1| blue }} |{{ safesubst:#if:1| blue }}]] | [[ {{ safesubst:#if:1| yes }} |{{ safesubst:#if:1| blue }}]]
}} |
blue }}
}} }} |
{{ font color | white | blue | Wikipedia:Example | link = Wikipedia:Sandbox }}
|
{{ safesubst:#if: Wikipedia:Example | {{ safesubst:#if: Wikipedia:Sandbox | yes | [[ {{ safesubst:#if:1| Wikipedia:Example }}|{{ safesubst:#if:1| Wikipedia:Example }}]] | {{ safesubst:#if:1| Wikipedia:Example }}
}} |
Wikipedia:Example }}
}} |
{{ safesubst:#if: Wikipedia:Sandbox | yes | [[ {{ safesubst:#if:1| blue }} |{{ safesubst:#if:1| blue }}]] | [[ {{ safesubst:#if:1| Wikipedia:Sandbox }} |{{ safesubst:#if:1| blue }}]]
}} |
blue }}
}} }} |
{{ font color | text = Wikipedia:Example | link = Wikipedia:Sandbox | bg
= blue | fg = white }}
|
{{ safesubst:#if: Wikipedia:Example | {{ safesubst:#if: Wikipedia:Sandbox | yes | [[ {{ safesubst:#if:1| Wikipedia:Example }}|{{ safesubst:#if:1| Wikipedia:Example }}]] | {{ safesubst:#if:1| Wikipedia:Example }}
}} |
Wikipedia:Example }}
}} |
{{ safesubst:#if: Wikipedia:Sandbox | yes | [[ {{ safesubst:#if:1| blue }} |{{ safesubst:#if:1| blue }}]] | [[ {{ safesubst:#if:1| Wikipedia:Sandbox }} |{{ safesubst:#if:1| blue }}]]
}} |
blue }}
}} }} |
The Plantilla:Para 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):
Plantilla:BigWikipedia:ExamplePlantilla:Big{{font color|white|blue|the Wikipedia:Example page}}Plantilla:Big- → [[Wikipedia:Example | {{ safesubst:#if: the Wikipedia:Example page
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| the Wikipedia:Example page }}|{{ safesubst:#if:1| the Wikipedia:Example page }}]]
| [[|{{ safesubst:#if:1| the Wikipedia:Example page }}]]
}}
| {{ safesubst:#if:1| the Wikipedia:Example page }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| blue }} |{{ safesubst:#if:1| blue }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| blue }}]]
}}
| {{ safesubst:#if:1| blue }}
}}
}}]] (a font-colored link), a font color does not accept a wikilink, it creates wikilinks itself with Plantilla:Para.
- Plantilla:OK {{ font color | green | violet | Wikipedia:Example | link=yes }} → {{ safesubst:#if: Wikipedia:Example
| {{ safesubst:#if: yes
| {{ safesubst:#ifeq: yes | yes
| [[ {{ safesubst:#if:1| Wikipedia:Example }}|{{ safesubst:#if:1| Wikipedia:Example }}]]
| {{ safesubst:#if:1| Wikipedia:Example }}
}}
| {{ safesubst:#if:1| Wikipedia:Example }}
}}
| {{ safesubst:#if: yes
| {{ safesubst:#ifeq: yes | yes
| [[ {{ safesubst:#if:1| violet }} |{{ safesubst:#if:1| violet }}]]
| [[ {{ safesubst:#if:1| yes }} |{{ safesubst:#if:1| violet }}]]
}}
| {{ safesubst:#if:1| violet }}
}}
}} (a Plantilla:Para Plantilla:Tl)
- Plantilla:Cross{{ font color | green | violet | the [[Wikipedia:Example]] page}} → {{ safesubst:#if: the Wikipedia:Example page
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| the Wikipedia:Example page }}|{{ safesubst:#if:1| the Wikipedia:Example page }}]]
| [[|{{ safesubst:#if:1| the Wikipedia:Example page }}]]
}}
| {{ safesubst:#if:1| the Wikipedia:Example page }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| violet }} |{{ safesubst:#if:1| violet }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| violet }}]]
}}
| {{ safesubst:#if:1| violet }}
}}
}} (Text with [[wikilink brackets]] overrides the designated color)
- Plantilla:Cross{{ font color | green | violet | [[Wikipedia:Exammple]] }} → {{ safesubst:#if: the Wikipedia:Exammple page
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| the Wikipedia:Exammple page }}|{{ safesubst:#if:1| the Wikipedia:Exammple page }}]]
| [[|{{ safesubst:#if:1| the Wikipedia:Exammple page }}]]
}}
| {{ safesubst:#if:1| the Wikipedia:Exammple page }}
}}
| {{ safesubst:#if:
| {{ safesubst:#ifeq: | yes
| [[ {{ safesubst:#if:1| violet }} |{{ safesubst:#if:1| violet }}]]
| [[ {{ safesubst:#if:1| }} |{{ safesubst:#if:1| violet }}]]
}}
| {{ safesubst:#if:1| violet }}
}}
}} (Text with [[wikilink brackets]] overrides the designated color)
For actual mainspace template usage, here are search links for
- Plantilla:Sl.
- Plantilla:Template usage.
- Plantilla:Sl showing its use in articles whose title begins with the letter "F".