Template:Color
This template can be used to specify the foreground color of a span of text. Acceptable values are RGB hex codes, e.g. #C9E72A, or any of the w:web colors: red, blue, green, moccasin, darkorchid, etc. To set the background color of a span of text, use {{background color}}.
Usage
{{color|name of color or hex code of color|Text}}
For example:
{{color|red|Hello, world!}}→ Hello, world!{{color|#00F000|Hello, world!}}→ Hello, world!
If the second parameter is omitted, the color value is displayed as text:
{{color|#00F000}}→ #00F000{{color|red}}→ red
Performance considerations
The template generates an HTML span tag:
<span style="color:{{{1}}}">{{{2}}}</span>
It runs at speeds in excess of 700 per second,[clarification needed] and so is functionally identical to using the HTML markup directly.
Template data
TemplateData for Color
The color template can be used to add a span of text with any given text color
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Color | 1 | CSS name of color or hex code of color, e.g. 'red' or '#00F000'. | String | required |
| Text | 2 | The string of text to be formatted in the desired color | String | suggested |
See also
| This tables shows the various color templates in use. | ||||
|---|---|---|---|---|
| Color Template | style="background: Color;"
|
{{Background color|Color}}
|
{{Color|Text}}
|
{{Colored link|Color}}
|
| {{White}} | Text | Text | Main page | |
| {{Silver}} | Text | Text | Main page | |
| {{Gray}} or {{Grey}} | Text | Text | Main page | |
| {{Black}} | Text | Text | Main page | |
| hot {{pink}} | Text | Text | Main page | |
| {{red}} | Text | Text | Main page | |
| {{darkRed}} | Text | Text | Main page | |
| {{maroon}} | Text | Text | Main page | |
| {{brown}} | Text | Text | Main page | |
| {{orange}} | Text | Text | Main page | |
| {{gold}} | Text | Text | Main page | |
| {{yellow}} | Text | Text | Main page | |
| {{olive}} | Text | olive | Main page | |
| {{lime}} | Text | Text | Main page | |
| {{green}} | Text | Text | Main page | |
| {{aqua}} | Text | Text | Main page | |
| {{lime}} | Text | Text | Main page | |
| {{cyan}} | Text | Text | Main page | |
| {{teal}} | Text | Text | Main page | |
| {{azure}} | Text | Text | Main page | |
| {{blue}} | Text | Text | Main page | |
| {{navy}} | Text | Text | Main page | |
| {{purple}} | Text | Text | Main page | |
| {{fuchsia}} | Text | Text | Main page | |
| {{magenta}} | Text | Text | Main page | |
Color templates
- {{Background color}} or {{bg}} - sets background color
- {{Color}} or {{Red}} etc. – sets text color
- {{Font color}} – sets both text and background color
- {{Talk quote inline}}
- {{CSScolor}} - sanitizes and partially converts color codes and color names into a format supported by CSS.
- {{resize}}